有时我必须检查互联网连接并为此使用“可达性”。
最好使用“可达性”手动检查互联网连接,例如:
BOOL status = ([[Reachability reachabilityForInternetConnection] currentReachabilityStatus] != NotReachable);
或者使用 Reachability 通知和
//Start listening for reachability notifications on the current run loop
- (BOOL) startNotifier;
通知是否需要一些电话资源,如电池等,如果我不使用“stopNotifier”,我会遇到一些问题吗?
谢谢
最佳答案
很简单:
- 如果您需要在某个时间点检查您是否有互联网连接,请使用单例
- 如果您需要跟踪特定时间段内互联网连接的变化,请使用通知程序 + 通知
关于iphone - Reachability startNotifier - 是否需要电话资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12457721/