“Reachability.h” "Reachability.m gives an Apple mach-o linker error while adding them

浪尽此生 提交于 2020-01-16 19:45:09

问题


I am creating an iPhone application, and I am using RestKit api to connect to the server. I am facing a problem whenever I add the Reachability.m and Reachability.h into the second UIViewController of the project. I tried making a new .m file in Xcode4 and now I get an Apple macho-linker (id) error on all tabst. I added it to the first UIViewcontroller it works normally, but when I try to add it to any other forms I receive this error.


回答1:


Have you added the SystemsConfigurations.Framework to your project? Apples reachability package requires the SystemConfigurations.Framework to be added before it can be used.

Also if you are using ARC (Automatic ReferenceCounting), ensure you have disabled ARC for that particular file. Do this by going to build phases, compile sources, then double clicking Reachability.m and entering -fno-objc-arc to disable ARC




回答2:


Solved it by importing ONLY "Reachability.h" not "Reachability.h" and "Reachability.m"




回答3:


Try adding CFNetwork.framework.



来源:https://stackoverflow.com/questions/12620271/reachability-h-reachability-m-gives-an-apple-mach-o-linker-error-while-adding

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