Re: Asynchronous downloading again
Re: Asynchronous downloading again
- Subject: Re: Asynchronous downloading again
- From: Roland King <email@hidden>
- Date: Sun, 1 Nov 2009 10:47:32 +0800
that's one way. Or have a boolean for each one which says when it's
been downloaded, or put all the connections in an NSArray or some kind
of dictionary and take each one out as it completes and call your
routine when the NSArray is empty (don't start any of the connections
until they are all in the array to avoid any potential race
condition). That's also entirely scalable and has the benefit that all
your current connections are easily found so you can cancel them if
you get an error on one of the other earlier connections and clean
up .. you are handling errors right, URL downloads fail.
(The comment about the race condition is because I don't know if it's
possible to get a connectionDidFailWithError: or
connectionDidFinishLoading: synchronously with submitting the request
or if you are guaranteed only to get any delegate callbacks only on
the next run of the runloop, anyone know definitively?).
On 01-Nov-2009, at 10:34 AM, DKJ wrote:
On 2009-10-31, at 19:22 , Roland King wrote:
You can trivially use one delegate to manage both these downloads,
have them happen at the same time and only call downloadFinished
when both of them have finished, or if you have more than 2, all 3,
or 4 or 127 of them.
What would be the best way to do this? Have the delegate count the
connections as they finish? That is starting to sound more appealing.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden