/**
监测网络的可链接性
@param strUrl URL地址
@return 是否可达
*/
+(BOOL)netWorkReachabilityWithURLString:(NSString *) strUrl {
__block BOOL netState = YES;
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
switch (status) {
case AFNetworkReachabilityStatusNotReachable:
case AFNetworkReachabilityStatusUnknown:
netState = NO;
break;
case AFNetworkReachabilityStatusReachableViaWiFi:
case AFNetworkReachabilityStatusReachableViaWWAN:
netState = YES;
break;
default:
break;
}
NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status));
}];
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
return netState;
}