NSOperationQueueis the best way to deal with this problem. In short, you wrap NSURLConnectionin NSBlockOperation, and then add it to the queue. A queue allows you to set various properties, such as the maximum number of concurrent connections, and also give you an easy way to cancel operations in a queue.
This design template has a good introduction to WWDC (2012) video titled “Creating Parallel User Interfaces on iOS”.
In iOS 5, you can use the following call to launch NSURLConnectionand add it toNSOperationQueue
+ (void)sendAsynchronousRequest:(NSURLRequest *)request queue:(NSOperationQueue *)queue completionHandler:(void (^)(NSURLResponse*, NSData*, NSError*))handler
source
share