// 网络监控
AFNetworkReachabilityManager *networkReachbilityManager = [AFNetworkReachabilityManager sharedManager];
[networkReachbilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
switch (status) {
case AFNetworkReachabilityStatusUnknown:
NSLog(@"GZQ1-未知网络");
break;
case AFNetworkReachabilityStatusNotReachable:
NSLog(@"GZQ1-断网");
break;
case AFNetworkReachabilityStatusReachableViaWWAN:
NSLog(@"GZQ1-蜂窝数据");
break;
case AFNetworkReachabilityStatusReachableViaWiFi:
NSLog(@"GZQ1-WiFi网络");
break;
default:
break;
}
}];
// 开启监控
[networkReachbilityManager startMonitoring];
网友评论