开发者

how to resume download while using NSURLConnection?

开发者 https://www.devze.com 2023-03-26 08:19 出处:网络
I am trying to开发者_JAVA百科 implement resume functionality while using NSURLConnection. I read URL Loading System Programming Guide provided by apple but they didn\'t have the info.

I am trying to开发者_JAVA百科 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消