Search code examples
iosreachability

reachabilityWithHostname return YES only once


I downloaded the projet Reachability on github : https://github.com/tonymillion/Reachability

i Have the same behavior on ios7 and ios8 (all devices on simulator).

After launching simulator with the wifi Turn ON on the computer i obtain that. The reachabilityWithHostname return Yes and indicate that google is reachable and it is ok.

enter image description here

But When i turn Off the wifi on my computer the reachabilityWithHostname indicates that google is not reachable what is normal But When again i turn the wifi ON i'm not able to have reachabilityWithHostname work it indicates that Google is not reachable. The same thing append when i launch the simulator with the wifi first turn off on my computer, the reachabilityWithHostname always indicate that google is not reachable and stay thus

enter image description here


Solution

  • It is a well known bug of simulators in xCode 6.

    Try the same on your device in debug mode. It should work correctly as in case of mine.

    Also I recommend to use the original version of Reachability from Apple.