Skip to content

Commit

Permalink
Merge pull request domesticcatsoftware#35 from evanlong/master
Browse files Browse the repository at this point in the history
Consistent use of main thread for success/failure callbacks in AFJSONRequestOperation
  • Loading branch information
Mattt Thompson committed Sep 21, 2011
2 parents 29ace55 + 330427d commit e67a7ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions AFNetworking/AFJSONRequestOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ + (id)operationWithRequest:(NSURLRequest *)urlRequest

if (error) {
if (failure) {
failure(request, response, error);
dispatch_async(dispatch_get_main_queue(), ^{
failure(request, response, error);
});
}
} else if ([data length] == 0) {
if (success) {
success(request, response, nil);
dispatch_async(dispatch_get_main_queue(), ^{
success(request, response, nil);
});
}
} else {
dispatch_async(json_request_operation_processing_queue(), ^(void) {
Expand Down

0 comments on commit e67a7ee

Please sign in to comment.