I need to download files > 500 Mo with AFNetworking. Sometimes, the time to download them is > 10 minutes and if the app is in background, the download can\'t be complete.
I ended up using the old (non ARC) ASIHTTPRequest framework for a similar task. AllowResumeForFileDownloads does what you need. Note that you server needs to support resuming by reading the Range http header.
if (![[NSFileManager defaultManager] fileExistsAtPath:downloadPath]){
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request setAllowResumeForFileDownloads:YES];
[request setDownloadDestinationPath:downloadPath];
[request setTemporaryFileDownloadPath:tmpPath];
[request startAsynchronous];
}
Update:
As steipete may wont maintain AFDownloadRequestOperation any more (https://github.com/steipete/AFDownloadRequestOperation/pull/68). NSURLSessionDownloadTask may be a better choice.
https://github.com/steipete/AFDownloadRequestOperation
Also, I write a lib base on AFDownloadRequestOperation: https://github.com/BB9z/RFDownloadManager