I want to know about how to download a bunch of files one after the other. It is like if I have 5 files to download, I should automatically download all the 5 files in a sequence 1 complete then 2 , 2 then 3 this way all five should be completed automatically. Its should all done in the background of my app . Thanks in advance
2 Answers
You should use NSURLSession. You can create a background session which will even continue to work after your app goes to the background and/or is terminated.
You ask the associated NSURLSessionTasks to download all the files, and the framework will take care of downloading as many of the files concurrently as makes sense (given the bandwidth etc.).
You'll be able to get download status if you need, and will get notified to completion of the downloads, even if your app wasn't running anymore. There's a lot to love about NSURLSession. You should consider it for all long running download/upload tasks.

- 39,196
- 16
- 97
- 124
I think you'll have to chain then manually. In other words keep your own queue of tasks. When one finishes remove it from the queue and start the next one.

- 1,346
- 1
- 12
- 25
-
Thanks for the answer, I have added them manually in a queue and then downloading each after each one is completed. – Gupta Jan 08 '14 at 13:36
-
i've messed with this a bit when ios 7 just came out and was having problems with chaining downloads like felix suggested. were you able to successfully implement this? – Joris Weimar Jan 21 '14 at 20:31
-
Yes I could implement this. I implemented my own queue for the download process and they are downloading properly. @Joris Weimar – Gupta Apr 21 '14 at 16:40