开发者

Conflict between class and static library

I'm using Layar Player in my app.

It provides a static library to include in your project.

After installing and trying to compile, I got this error:

ld: duplicate symbol _OBJC_CLASS_$_Reachability in //LayarPlayer/Debug/liblayarplayer.a(Reachability.o) and //MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/Reachability.o for architecture armv7

I'm using Reachability in my app to check network status, but it seems like it's already included in the library.

I've tried removing every #import Reachability in my code, but obviously I get "undecl开发者_如何学JAVAared function" errors.

How can I solve this?


You need to delete the references from the project. That means don't delete the #import Reachability but search for Reachability.m and Reachability.h in your project files and delete them so you only have one of each in your project.


I excluded all conflicting .m files from the target and everything is fine now.
Headers files must not be deleted.


I solved this same problem by

  1. check your project remove duplicate Reachability file;
  2. replacing old version of Reachability(I'm currently using version 2.2);
  3. put the -ObjC -all_load linker flags on.

Hope it may help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜