10

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
  • 2,904
  • 8
  • 42
  • 76

4 Answers4

11

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

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

Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
shoughton123
  • 4,255
  • 3
  • 21
  • 23
  • 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 – A for Alpha May 02 '12 at 15:07
  • 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??? – A for Alpha May 02 '12 at 15:19
  • I just read that as well, this is a tutorial of how to do this under iOS: [article](http://nachbaur.com/blog/resuming-large-downloads-with-nsurlconnection) – shoughton123 May 02 '12 at 15:25
  • 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? – A for Alpha May 03 '12 at 06:13
  • Yes you will I'm afraid but its not to hard to implement range headers. – shoughton123 May 03 '12 at 08:14
  • Got it... It needs some server side support as well. Task Accomplished :) Thank you – A for Alpha May 03 '12 at 08:35
1

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.

Saad
  • 8,857
  • 2
  • 41
  • 51
  • 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 May 02 '12 at 15:04
  • 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. – Saad May 02 '12 at 15:09
  • Are u talking something similar to RANGE HEADERS on the server side? – A for Alpha May 02 '12 at 15:12
0

FIXED SOLUTION :

Fixed broken link and here is the working Tutorial to resume FIle Download file in iOS.

MANISH PATHAK
  • 2,602
  • 4
  • 27
  • 31
-1

You can use "NSURLSession to pause and resume

sanju
  • 1