-ObjC flag for Restkit causes compilation error when I add libZSDK_API.a

柔情痞子 提交于 2020-01-14 18:54:54

问题


I am using the RestKit to consume web services. RestKit worked fine until I tried add the libZSDK_API.a library (this library is to manage the zebra printers by Network or bluetooth)

Several Tutorials indicate this step to add the RestKit to iOS Project:

  • Add in "other linker flags" the value -ObjC

But this flag (-ObjC) cause compilation error when I added the library, When I remove this flag the iOS app compile correctly but when I execute the app is crashed because the Project does not have the -ObjC flag.

I'm getting this Compilation error:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_Linea", referenced from:
      objc-class-ref in libZSDK_API.a(LineaBtPrinterConnection.o)
     (maybe you meant: _OBJC_CLASS_$_LineaBtPrinterConnection)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

回答1:


The Zebra API links to another API for Bluetooth communication thru the IPC Linea Sled device. The LineaBtPrinterConnection links to that library file (libdtdev.a). Normally, if you don't care about the BT communication thru the sled, you don't have to link that library in, but since you're adding that -ObjC flag, it's loading that file and looking for that library.

If you add the libdtdev.a library to your project, that error should go away. The library should be included in the download you got from Zebra under the "Demos" project folder. If you need to actually use the sled, depending on the firmware version of the sled, you may need a new version from IPC, which you can get if you sign up as a developer on their site.




回答2:


I bet your app would build successfully for the device. The problem you're seeing is when you build for the simulator (which I can tell because it says "not found for architecture i386").

How are you building "libZSDK_API"? From source? If so, make sure you also build it for the simulator. If not, the vendor needs to include symbols for "i386" in the .a file they deliver.



来源:https://stackoverflow.com/questions/15797711/objc-flag-for-restkit-causes-compilation-error-when-i-add-libzsdk-api-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!