Use finishTasksAndInvalidate instead of invalidateAndCancel

-cleanup is only called when the task has finished, so it's safe to do this.
This silences a spurious warning logged by NSURLSession (or somewhere else internal):

Task <BB2AE4EF-8E93-44D7-9AB3-6EE9A9E3ACF8>.<1> load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://example.com/appcast.xml, NSErrorFailingURLKey=https://example.com/appcast.xml, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDownloadTask <BB2AE4EF-8E93-44D7-9AB3-6EE9A9E3ACF8>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <BB2AE4EF-8E93-44D7-9AB3-6EE9A9E3ACF8>.<1>, NSLocalizedDescription=cancelled} [-999]
This commit is contained in:
Kent Sutherland committed 2018-12-14 12:49:20 -06:00
1 parent 2e1596c673
commit 01bc8628da
1 file changed
+1 -1
+1 -1
View File
@@ -115,7 +115,7 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
{
[self enableAutomaticTermination];
[self.download cancel];
[self.downloadSession invalidateAndCancel];
[self.downloadSession finishTasksAndInvalidate];
self.download = nil;
self.downloadSession = nil;
self.delegate = nil;