Dispatching completion block on a custom thread

suggest change

AFNetworking starts the request off the main thread. By default, the completion block is delivered on the main queue. completionQueue chooses a different queue. request and myQueue must already exist. The queue below is serial.

AFNetworking 2.xx:

// Create dispatch_queue_t with your name and DISPATCH_QUEUE_SERIAL as for the flag
dispatch_queue_t myQueue = dispatch_queue_create("com.CompanyName.AppName.methodTest",
                  DISPATCH_QUEUE_SERIAL);

// init AFHTTPRequestOperation of AFNetworking
operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];

// Run this operation's completion block on myQueue, not the main queue.
[operation setCompletionQueue:myQueue];

AFNetworking 3.xx:

AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] init];
[manager setCompletionQueue:myQueue];

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents