From fafec572460fc47934c0bb8c1872646672a88f4d Mon Sep 17 00:00:00 2001 From: David Barker Date: Tue, 26 Jul 2016 17:51:04 +0100 Subject: [PATCH] Completing operation before executing callback, in order to reproduce previous AFHTTPRequestOperationManager behaviour. --- Source/AFHTTPSessionOperation.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/AFHTTPSessionOperation.m b/Source/AFHTTPSessionOperation.m index d494fcf..0b207a5 100644 --- a/Source/AFHTTPSessionOperation.m +++ b/Source/AFHTTPSessionOperation.m @@ -42,15 +42,15 @@ + (instancetype)operationWithManager:(AFHTTPSessionManager *)manager AFHTTPSessionOperation *operation = [[self alloc] init]; NSURLSessionTask *task = [manager dataTaskWithHTTPMethod:method URLString:URLString parameters:parameters uploadProgress:uploadProgress downloadProgress:downloadProgress success:^(NSURLSessionDataTask *task, id responseObject){ + [operation completeOperation]; if (success) { success(task, responseObject); } - [operation completeOperation]; } failure:^(NSURLSessionDataTask *task, NSError *error) { + [operation completeOperation]; if (failure) { failure(task, error); } - [operation completeOperation]; }]; operation.task = task;