Alex
Alex

Reputation: 68

Reachability and reachabilityWithHostName

I am using iOS 7.1 (XCode 5.1) and recently downloaded Tony Million's Reachability library and later Apples example code. When testing, both successfully detected when i turned WiFi off, however upon reconnection the hostname remained unreachable.

Trying to identify why I looked at HTTP traffic and it appears that the remoteHostName is no longer being used and instead three randomized hostname requests (eg. http://jcyoxhjblg).

Edit The above statement is incorrect, it appears these three connections are not related to reachability but a Chrome DNS feature which executes on reconnection. I am still looking into why it remains unreachable on reconnection.

I have tested from both sample codes (apple's excerpt below) on the local simulator with both www.apple.com and www.google.com (with and without http://). Both deliver the results shown/mentioned above.

Am I missing some basic understanding of how hostname reachability is provided from within Reachability ?

NSString *remoteHostName = @"www.google.com";
self.hostReachability = [Reachability reachabilityWithHostName:remoteHostName];
[self.hostReachability startNotifier];
[self updateInterfaceWithReachability:self.hostReachability];

Upvotes: 1

Views: 2269

Answers (1)

ziggear
ziggear

Reputation: 944

I think you should initial another Reachability object and call "[self.hostReachability startNotifier]" everytime your app wake from background, because method "startNotifier" depends on whether CurrentRunloop is running.

Upvotes: -1

Related Questions