继续一些小知识点,想起来就贴出来。
监测网络状态1.主动监测监测网络状态是否WIFI+ (BOOL)isEnableWIFI {return ([[Reachability reachabilityForLocalWiFi] currentReachabilityStatus] != NotReachable);}是否3G+ (BOOL)isEnable3G {return ([[Reachability reachabilityForInternetConnection] currentReachabilityStatus] != NotReachable);}2.监控网络状态1> 监听通知[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkStateChange) name:kReachabilityChangedNotification object:nil];2> 开始监听网络状态获得Reachability对象self.reachability = [Reachability reachabilityForInternetConnection];开始监控网络[self.reachability startNotifier];3> 移除监听[self.reachability stopNotifier];[[NSNotificationCenter defaultCenter] removeObserver:self];