1

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!

lsp
  • 171
  • 1
  • 5
  • 10

2 Answers2

9

https://github.com/tonymillion/Reachability

iOS5 / GCD / ARC friendly version

Tony Million
  • 4,296
  • 24
  • 24
  • 2
    You can even use blocks instead of the NSNotificationCenter – Tony Million Mar 14 '12 at 07:41
  • Was not a question of the original Reachability not working for me, it was not triggering the network unreachable notification. This lib works better! Thanks – Carlos Ricardo Apr 27 '12 at 11:04
  • @Tony looks like the blocks work on iOS 5.1. I have a method that check the connectivity to my server every one hour for sending som result of surveys, but not always it will get executed. UnreachableBlock method react well , but the reachableBlock not always. – lagos Jul 12 '12 at 09:57
  • Hi Tony: Any reason why notifications won't get posted when checking for reachability? Debugging shows that it's getting to the `postNotificationName` code within `reachabilityChanged` but the notification is never observed in the view controller. I tried using blocks and it shows Reachable, but I'd like to understand both methods. – iwasrobbed Oct 13 '12 at 13:58
0

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.

Zhang
  • 11,549
  • 7
  • 57
  • 87