It looks like, despite what the getter for delegateQueue says, the NSURLSession is indeed using your NSOperationQueue. I added KVO for the "operations" property on the queue:
[queue addObserver:self forKeyPath:@"operations" options:NSKeyValueObservingOptionNew context:NULL];
And added the following method:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
NSLog(@"%@%@", object, change);
NSOperationQueue *queue = (NSOperationQueue *)object;
NSLog(@"The queue in KVO: %@", queue);
NSLog(@"Max op Count in KVO: %i", queue.maxConcurrentOperationCount);
NSLog(@"%@", self.session.delegateQueue);
}
And it prints:
2013-09-29 07:45:13.751 sotest1[17214:1403] <NSOperationQueue: 0x895e0c0>{name = 'NSOperationQueue 0x895e0c0'}
2013-09-29 07:45:13.757 sotest1[17214:4207] <NSOperationQueue: 0x98a0940>{name = 'NSOperationQueue 0x98a0940'}{
kind = 1;
new = (
"<NSBlockOperation: 0x9a52370>"
);
}
2013-09-29 07:45:13.757 sotest1[17214:4207] The queue in KVO: <NSOperationQueue: 0x98a0940>{name = 'NSOperationQueue 0x98a0940'}
2013-09-29 07:45:13.757 sotest1[17214:4207] Max op Count in KVO: 5
So you can see the delegate does indeed get processed by your queue, despite the fact that the getter says otherwise. Weird.
Btw, the way you're doing it is also exactly AFNetworking does it, which is generally a good sign: https://github.com/AFNetworking/AFNetworking/blob/master/AFNetworking/AFURLSessionManager.m#L287