我使用最新的 AFNetworking 源,但可达性对我不起作用,它永远不会触发可达性块并且[httpClient networkReachabilityStatus]
总是返回 -1。SystemConfiguration/SystemConfiguration.h 包含在 .pch 中
startMonitoringNetworkReachability 被执行(在 AFHTTPClient 中)。
iPhone 4、iOS 6.1
AFHTTPClient *httpClient = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:URL]];
[httpClient setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
NSLog(@"Internet status changed");
NSLog(@"%d", status);
}];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:method parameters:post];
NSLog(@"Network reach %d",[httpClient networkReachabilityStatus]);
AFJSONRequestOperation *operation = [self getOperationWithMethod:method withRequest:request andCallback:callback];
[operation start];