开发者

how to resume download while using NSURLConnection?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜