From f1fa6f1a6f664e9fdbceb728b9dccdf04505631a Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Mon, 10 Oct 2011 13:18:41 -0500 Subject: [PATCH] [Issue #56] Wrapping completion block in async_dispatch to main queue --- AFNetworking/AFURLConnectionOperation.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index 8015bd6..be7e10f 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -149,8 +149,10 @@ static inline NSString * AFKeyPathFromOperationState(AFOperationState state) { __block id _blockSelf = self; [super setCompletionBlock:^ { - block(); - [_blockSelf setCompletionBlock:nil]; + dispatch_async(dispatch_get_main_queue(), ^(void) { + block(); + [_blockSelf setCompletionBlock:nil]; + }); }]; }