Re: Asynchronous downloading again

2009-11-02 Thread Alastair Houghton
On 2 Nov 2009, at 15:05, Alex Kac wrote: 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. It isn't really a good example of downloading HTML pages

Re: Asynchronous downloading again

2009-11-02 Thread Alex Kac
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 ar

Re: Asynchronous downloading again

2009-11-01 Thread Jens Alfke
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

Re: Asynchronous downloading again

2009-10-31 Thread Ken Thomases
On Oct 31, 2009, at 11:19 PM, DKJ wrote: 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

Re: Asynchronous downloading again

2009-10-31 Thread Claus Guttesen
> 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.) > > > Any suggestions about how to do all of this with multiple NSURLConnections > would be quite welcome. Elegant code

Re: Asynchronous downloading again

2009-10-31 Thread DKJ
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.

Re: Asynchronous downloading again

2009-10-31 Thread Roland King
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 a

Re: Asynchronous downloading again

2009-10-31 Thread DKJ
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

Re: Asynchronous downloading again

2009-10-31 Thread Roland King
The trouble? Since you must already have the NSURLRequests then you're talking about the difference between [ [ NSURLConnection alloc ] initWithRequest:request delegate:self ] vs [ NSURLConnection sendSynchronousRequest:request returningResponse... ] don't see the extra troub

Re: Asynchronous downloading again

2009-10-31 Thread Roland King
So you've used the observation that your user interface element is animating a spin to decide that mixing synchronous and asynchronous calls is somehow causing things to happen on different threads; you're programming backwards. Also what you're doing here is making your app as slow as it c

Re: Asynchronous downloading again

2009-10-31 Thread DKJ
I'm still not getting this. Why go to the trouble of setting up four separate NSURLConnections when one will do the job? And at the same time give me a very simple way to know when all the data is in place? If the files took a long time to download, I could see it. But these take less than

Re: Asynchronous downloading again

2009-10-31 Thread Kyle Sluder
On Sat, Oct 31, 2009 at 6:50 PM, DKJ wrote: > I was worried that having a download connection for each file would make it > more complicated for the app to know when they were all finished. Translation: "I don't know how to do it correctly, and therefore fear it. I want to stick to what I know."

Re: Asynchronous downloading again

2009-10-31 Thread DKJ
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 pro

Re: Asynchronous downloading again

2009-10-31 Thread Roland King
The whole point of doing things asynchronously is you don't have to care about waiting for one thing to do another thing, just set up two NSURLConnections and start them going at the same time. So unless you need some information from file 1 before starting on file 2 connection1 = [ [ NSUR