When using async download methods and delegates, is it possible to start multiple simultaneous nsconnections and handle them separately as each query completes? Or, will the system not automatically distinguish between them as your delegates receive pieces from each query? In which case, what would be a good approach to identify each connection uniquely as it enters through the delegates?
When using async download methods and delegates, is it possible to start multiple simultaneous
Share
The system won’t automatically distinguish the
NSURLConnections, instead, each delegate methods called is precising the concerned connection.For example :
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;the connection is
connection. This way you can set severalNSURLConnections and react accordingly.I personnaly set
NSURLConnectionobjects as ivars and test for equality in delegate methods, because using delegate, you will need to access the data containers from different methods.You will find more information in the excellent URL Loading System Programming Guide from Apple.