我在cocoapods(2.0.0-RC2)上获得了AFNetworking版本,在AFURLSessionManager.m文件中,该方法不会在成功块对面的主线程上调用失败块。这是故意的还是库的错误?
- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
success:(void (^)(NSURLResponse *response, id responseObject))success
failure:(void (^)(NSError *error))failure
{
NSURLSessionDataTask *task = [self.session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
if (failure) {
failure(error);
}
} else {
....
id responseObject = [self.responseSerializer responseObjectForResponse:response data:data error:&serializationError];
dispatch_async(dispatch_get_main_queue(), ^(void) {
if (serializationError) {
if (failure) {
failure(serializationError);
}
} else {
if (success) {
success(response, responseObject);
}
}
}