Multiple background downloads in ios7 using NSURLSessionConfigurations

349 views Asked by At

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

There are 2 answers

0
mahboudz On BEST ANSWER

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.

3
Felix On

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.