Re: Asynchronous downloading again
Re: Asynchronous downloading again
- Subject: Re: Asynchronous downloading again
- From: Jens Alfke <email@hidden>
- Date: Sun, 1 Nov 2009 11:25:37 -0800
On Oct 31, 2009, at 6:50 PM, DKJ wrote:
All of the files have to be downloaded before the app can do
anything. I get the connectionDidFinishLoading delegate method of my
one and only NSURLConnection to call a downloadFinished method at
the end of the synchronous downloads, so the app knows everything is
in place and can start processing the files.
All NSURLConnection delegate methods are called on the main thread.
(Actually on the same thread from which you started the
NSURLConnection.) This is true of pretty much everything in Cocoa: the
only time any of your code runs on a different thread is when you
explicitly request it, by using NSThread or NSOperationQueue (or the
dispatcher API in 10.6.)
Don't go back to using synchronous connections. They will block the
main thread, and there's no sense in using two different techniques to
solve the same problem.
Your approach of starting each connection when the previous one
finishes is fine. If all of these downloads are coming from the same
server, and you can't do anything till they're all done, you're
probably not going to gain anything by doing them in parallel: either
way, the limiting factor will be the speed of the user's Internet
connection.
—Jens_______________________________________________
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