我的应用程序需要互联网连接,因此在 ApplicationDelegate 中,applicationDidFinishLaunching
我正在运行以下命令:
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reachabilityChanged:) name: kReachabilityChangedNotification object: nil];
hostReach = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain];
[hostReach startNotifer];
[self updateInterfaceWithReachability: hostReach];
但由于某种原因,这似乎被触发了两次,因为记录的内容如下:
2010-02-04 14:25:48.004 myApp[201:207] Reachability Flag Status: -- ------- networkStatusForFlags
2010-02-04 14:25:48.240 myApp[201:207] STATUS: Access Not Available
2010-02-04 14:25:48.499 myApp[201:207] Reachability Flag Status: -- ------- networkStatusForFlags
2010-02-04 14:25:48.517 myApp[201:207] STATUS: Access Not Available
这很好,它正在工作,但我有一条警告消息通知用户没有连接,它弹出两次......
为什么可达性通知会触发两次?