reachabilityWithHostname return YES 只有一次

reachabilityWithHostname return YES only once

我在 github 上下载了可达性项目:https://github.com/tonymillion/Reachability

我在 ios7 和 ios8(模拟器上的所有设备)上有相同的行为。

在电脑上打开 wifi 启动模拟器后,我得到了。 reachabilityWithHostname return 是并表示 google 是可达的并且没问题。

但是当我关闭计算机上的 wifi 时,reachabilityWithHostname 指示 google 无法访问这是正常的但是当我再次打开 wifi 时,我无法让 reachabilityWithHostname 工作它指示Google 无法访问。 当我首先在我的计算机上关闭 wifi 启动模拟器时附加同样的事情,reachabilityWithHostname 总是指示 google 无法访问并保持

这是xCode6中模拟器的一个众所周知的错误。

在您的设备上以调试模式尝试相同的操作。它应该像我的一样正常工作。

另外我推荐使用original version of Reachability from Apple