jeeva
jeeva

Reputation: 31

How to download data from internet with resume option..?

i am downloading content from server to my app. i am using NSUrlConnection to that in response i am getting data and i am storing that. But if user quits the app while downloading when he launches app next time i have to resume that download from where it stop(download remaining part). how to support this ... is any idea on how to handle this ....

Thanks in advance.

Upvotes: 3

Views: 664

Answers (3)

The iOSDev
The iOSDev

Reputation: 5267

So now from ios5 you can do this with the NSURLConnectionDownloadDelegate Protocol and also you can have some reference see this appleDocument

Upvotes: 0

Nareshkumar
Nareshkumar

Reputation: 2351

Not pretty sure about how to get the implementation but i can suggest a design for the same. When the connection gets the response in connectionDidReceiveResponse method, you can store the total content length. Once the app is quit, the received data length can be stored in a plist for further reference.

Once the user resumes the application, there is a range request which can be specified in the headers of your request to get the file download from that point. Thats pretty much like downloading from the point where you started it.

This is actually a good idea. I think i shall work on it and get back to you.

Upvotes: 2

Tirth
Tirth

Reputation: 7789

HI. You need to read and understand complete class reference of NSURLDownload which will be helpful for you.In NSRULDownload class please findout Resuming Partial Downloads methods.

Upvotes: 0

Related Questions