iOS Development Journal

Tips and Tricks Learned the Hard Way

NSURLSession delegateQueue Silently Fails if Passed the Main Queue

Of important note: If you want your callbacks to come on the main queue, you cannot create an NSURLSession with sessionWithConfiguration:delegate:delegateQueue: and pass [NSOperationQueue mainQueue] as the delegateQueue argument. All requests will silently fail, and never return if you do.

Instead you must continue to us dispatch_async(dispatch_get_main_queue(), ...) or [[NSOperationQueue mainQueue] addOperationWithBlock:...].