Gupta
Gupta

Reputation: 53

Multiple background downloads in ios7 using NSURLSessionConfigurations

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

Upvotes: 2

Views: 341

Answers (2)

mahboudz
mahboudz

Reputation: 39376

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.

Upvotes: 2

Felix
Felix

Reputation: 1384

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.

Upvotes: 0

Related Questions