How to pause/resume downloads in iPhone (iOS)

13,901

Solution 1

Here's a tutorial of how to do this on IOS.

Also check documentation. This will require your server to support range headers.

Solution 2

this needs synchronization both at server as well as client side. and i allready told u to use chunks. definetely chunks is the only solution if you want to pause. you will send the server with a chunk id to stop till this i'll get remaing next and next time you will ask from that id.

Share:
13,901
A for Alpha
Author by

A for Alpha

iOS application developer and a huge steve Jobs fan. The beauty of the apple products motivated me to be a iOS apps developer and i am in love with it... :)

Updated on June 11, 2022

Comments

  • A for Alpha
    A for Alpha almost 2 years

    I have to download large amount of data (anywhere between 300MB - 1GB).

    I am currently using **NSURLConnection**to download the data. But, now i am looking at a scenario where the user might loose the internet connection during the download process. Currently i am restarting the entire download process in this scenario, which i think is a very bad way of downloading and a waste of user bandwidth.

    Is there a process in which i can manage the downloads with Pause/Resume functionality while downloading.

  • A for Alpha
    A for Alpha almost 12 years
    thanks for the response saad... Can you please be more specific technically. I mean, can you explain a bit more on how to do it... Any links would also be helpful
  • A for Alpha
    A for Alpha almost 12 years
    oops.... I guess this works only for MAC OS and NOT for iOS.. Correct me if im wrong !! I am clearly looking for something that works on iOS
  • Saad
    Saad almost 12 years
    sorry no idea about link. you may google it. infact i implemented some thing similar to this in my app. the thing is server sends a message having information about the number of packets to be receive. the client sends ok and communication starts, whenever the client needs to pause. it will send a message through webservice that stop till now, that i have received these packets. next time when client will request the resume process, it server had the information of last sent packets, so it will start sending remaining packets, the basic thing is to shift most your working on server side.
  • A for Alpha
    A for Alpha almost 12 years
    Are u talking something similar to RANGE HEADERS on the server side?
  • A for Alpha
    A for Alpha almost 12 years
    i guess we need use NSURLDownload class to make use of this function. But the documentation clearly says NSURLDownload is not available for iOS. Any ideas on that???
  • shoughton123
    shoughton123 almost 12 years
    I just read that as well, this is a tutorial of how to do this under iOS: article
  • A for Alpha
    A for Alpha almost 12 years
    what a co-incidence.. I found the same article on web some time back and went through it.. But a small question.. Do we need our servers to support range headers in order to accomplish this task?
  • shoughton123
    shoughton123 almost 12 years
    Yes you will I'm afraid but its not to hard to implement range headers.
  • A for Alpha
    A for Alpha almost 12 years
    Got it... It needs some server side support as well. Task Accomplished :) Thank you