BK Choi
BK Choi

Reputation: 75

how to resume download while using NSURLConnection?

I am trying to implement resume functionality while using NSURLConnection. I read URL Loading System Programming Guide provided by apple but they didn't have the info. Thank you very much for your help.

Upvotes: 0

Views: 1691

Answers (1)

VenoMKO
VenoMKO

Reputation: 3294

There is no such functionality. But you can create your own resume function. You'll need to add byte-range header. To achieve that you need to know file size and downloaded part size. And of course server must accept byte-range requests, otherwise its useless. Here is a sample of adding range header:

[request setValue:@"12345-99999" forHTTPHeaderField:@"Range"];

12345 - downloaded part size + 1 byte
99999 - total file size

Upvotes: 6

Related Questions