使用AFNetworking框架监听网络变化
AFNetworkReachabilityManager * manager = [AFNetworkReachabilityManager sharedManager];
[manager startMonitoring];
__weak __typeof__ (self) wself = self;
[manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
__strong __typeof (wself) sself = wself;
if (status != AFNetworkReachabilityStatusNotReachable) {
NSLog(@"网络状况变为可用");
}
}];