Conflict between class and static library

↘锁芯ラ 提交于 2019-12-12 02:38:58

问题


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 "undeclared function" errors.
How can I solve this?


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/6725008/conflict-between-class-and-static-library

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