Would this be helpful?

http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/

It shows how to use NSOperationQueue, but it uses downloading HTML pages as an example.

On Oct 31, 2009, at 11:19 PM, DKJ wrote:

On 2009-10-31, at 19:34 , Roland King wrote:
. And why are you now talking about 4 NSURLConnections when you say you have 2 files?


The 2-file example was a simplified case I posted when I was asking whether the method would work. I actually have half-a-dozen or so data files to download. (It can vary.)

I'm using the delegate to save the files to disk under different names, so the delegate has to know which filename to use for which connection. There's even a file that needs to be downloaded containing the names of other files that need to be downloaded.

That's why I was doing things like this in the delegate (after the initial received data was dealt with):

url = [NSURL URLWithString:[baseURL stringByAppendingPathComponent:filename]];
  dataString = [NSString stringWithContentsOfURL:url ...];
  [dataString writeToFile:filename ...];

(I left out some parameters to make it easier to read.)

I'd be quite happy to do the whole thing synchronously: it's plenty fast enough. But I wanted my little activity spinner to display, even if it was only for a few seconds.

Any suggestions about how to do all of this with multiple NSURLConnections would be quite welcome. Elegant code is a worthwhile end in itself, even if there is no practical benefit in a particular case._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net

This email sent to a...@webis.net

Alex Kac - President and Founder
Web Information Solutions, Inc.

"You cannot build a reputation on what you intend to do."
-- Liz Smith




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to