开发者

Check if a file is complete after downloading in Objective-c

I am implementing resumable file downloading for the iPhone, and I nee开发者_开发问答d to know how I can tell whether a file I have previously downloaded is complete or not before I attempt to redownload.


I've decided to use a '.part' or similar extension for files that are in progress of being downloaded. Then once the -(void)connectionDidFinishLoading:(NSURLConnection *)connection method executes, I will rename it.


You'll need to store the information about the size of the complete file somewhere that can be matched up with the partially downloaded file -- or, in the least, something that indicates the file is partially downloaded.

When your app wants to do anything with any of the downloaded files, it needs to check for partially downloaded content (i.e. actual size of data you have < complete file size) -- if it's only downloaded partially, it needs to kick off a resume download.

Without more specific info, can't say much more than that!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜