我在 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);
}
}
}