Skip to content

Instantly share code, notes, and snippets.

@Drewsmits
Last active April 6, 2016 06:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Drewsmits/6749279 to your computer and use it in GitHub Desktop.
Save Drewsmits/6749279 to your computer and use it in GitHub Desktop.
NSURLSession Delegate Queue maxConcurrentOperationCount test
- (void)viewDidLoad
{
[super viewDidLoad];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
queue.maxConcurrentOperationCount = 5;
NSLog(@"The queue before: %@", queue);
NSLog(@"Max op Count before: %i", queue.maxConcurrentOperationCount);
NSURLSession *session = [NSURLSession sessionWithConfiguration:nil
delegate:nil
delegateQueue:queue];
NSLog(@"The queue after: %@", session.delegateQueue);
NSLog(@"Max op Count after : %i", session.delegateQueue.maxConcurrentOperationCount);
}
// The queue before: <NSOperationQueue: 0x165b2970>{name = 'NSOperationQueue 0x165b2970'}
// Max op Count before: 5
// The queue after: <NSOperationQueue: 0x165db5f0>{name = 'NSOperationQueue 0x165db5f0'}
// Max op Count after : 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment