I am using the NSURLSessionDownloadTask
to download a web file.
When I use [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:]
to create NSURLSessionConfiguration
, I found NSURLSessionDownloadTask
continue downloading even if I kill the App.
This is not what I expect, I just want it download in the background. I don't want to kill the app, it's still being downloaded.
NSURLSessionConfiguration *config = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@"DDDownloader"];
config.timeoutIntervalForRequest = 10;
self.session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil];
NSURLSessionDownloadTask *downloadTask = [self.session downloadTaskWithURL:[NSURL URLWithString:downloadModel.url]];
[downloadTask resume];
I hope that after I kill the app, the app will no longer perform the download task.