From 01bc8628daae31f8260f7ca4cb3fad58827b3e6c Mon Sep 17 00:00:00 2001 From: Kent Sutherland Date: Fri, 14 Dec 2018 18:48:12 +0000 Subject: [PATCH] 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 .<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 .<1>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask .<1>, NSLocalizedDescription=cancelled} [-999] --- Downloader/SPUDownloader.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Downloader/SPUDownloader.m b/Downloader/SPUDownloader.m index a49a57f2..9e7d2d2a 100644 --- a/Downloader/SPUDownloader.m +++ b/Downloader/SPUDownloader.m @@ -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;