Search code examples
objective-cskmaps

Undefined symbols for architecture arm64: "_OBJC_CLASS_$_CMAltimeter", referenced in SKMaps


Recently I started having this error that I cannot fix.

I included all the frameworks i need in order to use Skobbler maps as intended and I have never again had this issue (and I did use SKMaps in other projects).

As I was searching around for the solution I noticed that before July 2014. there was another SDK for 64bit systems that I should use, but I see that now it's all sorted out from the Skobbler team.

Can anyone point me on what exactly could be a problem here?

note: I manually drag and drop SKMaps.framework in my project and did select "Copy items if needed"


Solution

  • Make sure you are linking the CoreMotion framework.

    Anytime you have linking problems, refer to the documentation first to see which dependencies it has (in this case, @import CoreMotion).

    In case you are sure and ask yourself: "But I'm sure this symbol is in this framework!", as you felt when you said SKMaps.framework was linked and it should solve it, you can check if the missing symbol (_OBJC_CLASS_$_CMAltimeter in this case) is part of that framework.

    On Terminal, you can run:

    nm -g /path/to/SKMaps.framework/SKMaps
    

    and check if the symbol is there.

    To make it easier:

    nm -g /path/to/SKMaps.framework/SKMaps | grep CMAltimeter
    

    In this example, you wouldn't find it, because it's not part of it. But if you run:

    nm -g /path/to/CoreMotion.framework/CoreMotion | grep CMAltimeter
    

    You will see that the symbols are there.

    If it's not there, it's because it is not part of this library/framework/version and you should find where it is. If it IS there indeed, it means it is not being linked during compilation, and adding it to the link options should solve it.