iOS 5.1 Reachability

可紊 提交于 2019-12-12 09:19:17

问题


I am trying to use Reachability in ios 5.1 but it gives me a Match-o Linker error. I am using Xcode 4.3 and building my app with armv6 and armv7. I have read that Reachability doesn't play nice with armv7, which may be causing the error. Is that true? If so, is ythere any workaround to get my app checking internet connectivity? And yes, i have imported both

Reachability.h

and

SystemConfiguration.framework

My sample implementation code is as below:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkNetworkStatus:) name:kReachabilityChangedNotification object:nil];    
internetReachable = [Reachability reachabilityForInternetConnection];
[internetReachable startNotifier];    
hostReachable = [Reachability reachabilityWithHostName: @"www.apple.com"];
[hostReachable startNotifier];

Thanks in advcance!


回答1:


https://github.com/tonymillion/Reachability

iOS5 / GCD / ARC friendly version




回答2:


Not sure whether you have solved this problem yet.

But if you read the actual error highlighted in Xcode 4 and if it says something like

"ld: duplicate symbol _OBJC_IVAR_$_Reachability.reachabilityRef in . . . linker command failed with exit code 1 (use -v to see invocation)"

That is saying you have already included Reachability.h and Reachability.m in your project somewhere and you now have included a duplicate copy.

Delete all the duplicate copies of Reachability.h and Reachability.m and leave just 1 copy of it somewhere in your project files.



来源:https://stackoverflow.com/questions/9695067/ios-5-1-reachability

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