Answer the question
In order to leave comments, you need to log in
Saving downloaded data to NSURLSessionDownloadTask when app process terminates?
Found a good example of working with the new NSURLSession : iOS7_Multitasking .
The example implements the function of stopping the download and saving resumeData for subsequent resuming:
- (void) stopDownloadWithTaskIdentifier:(NSUInteger)taskIdentifier
{
KDownloadInfo *di = [self.downloadInfoDictionary objectForKey:kDownloadInfoKey(taskIdentifier)];
if (di && di.downloadTask) {
[di.downloadTask cancelByProducingResumeData:^(NSData *resumeData) {
NSLog(@"RESUME DATA %@", resumeData);
if (resumeData) {
di.resumeData = resumeData;
}
}];
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question