模拟机下测试结果
主要代码
-(void)HTTPManagerReachability{
NSURL *baseURL = [NSURL URLWithString:@"http://www.baidu.com"];
AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:baseURL];
NSOperationQueue *operationQueue = manager.operationQueue;
[manager.reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
switch (status) {
case AFNetworkReachabilityStatusReachableViaWWAN: NSLog(@"AFNetworkReachabilityStatusReachableViaWWAN");
case AFNetworkReachabilityStatusReachableViaWiFi:
{
NSLog(@"AFNetworkReachabilityStatusReachableViaWiFi");
[operationQueue setSuspended:NO];
}
break;
case AFNetworkReachabilityStatusNotReachable:
{
NSLog(@"AFNetworkReachabilityStatusNotReachable");
}
default:
[operationQueue setSuspended:YES];
break;
}
}];
[manager.reachabilityManager startMonitoring];
}