diff --git a/Sources/General/SessionManager.swift b/Sources/General/SessionManager.swift index afc7859..546b753 100644 --- a/Sources/General/SessionManager.swift +++ b/Sources/General/SessionManager.swift @@ -440,6 +440,10 @@ extension SessionManager { public func start(_ task: DownloadTask, onMainQueue: Bool = true, handler: Handler? = nil) { operationQueue.async { + guard let _ = self.fetchTask(task.url) else { + self.log(.error("can't start downloadTask", error: TiercelError.fetchDownloadTaskFailed(url: task.url))) + return + } self._start(task, onMainQueue: onMainQueue, handler: handler) } } @@ -479,6 +483,10 @@ extension SessionManager { public func suspend(_ task: DownloadTask, onMainQueue: Bool = true, handler: Handler? = nil) { operationQueue.async { + guard let _ = self.fetchTask(task.url) else { + self.log(.error("can't suspend downloadTask", error: TiercelError.fetchDownloadTaskFailed(url: task.url))) + return + } task.suspend(onMainQueue: onMainQueue, handler: handler) } } @@ -500,6 +508,10 @@ extension SessionManager { public func cancel(_ task: DownloadTask, onMainQueue: Bool = true, handler: Handler? = nil) { operationQueue.async { + guard let _ = self.fetchTask(task.url) else { + self.log(.error("can't cancel downloadTask", error: TiercelError.fetchDownloadTaskFailed(url: task.url))) + return + } task.cancel(onMainQueue: onMainQueue, handler: handler) } } @@ -526,6 +538,10 @@ extension SessionManager { public func remove(_ task: DownloadTask, completely: Bool = false, onMainQueue: Bool = true, handler: Handler? = nil) { operationQueue.async { + guard let _ = self.fetchTask(task.url) else { + self.log(.error("can't remove downloadTask", error: TiercelError.fetchDownloadTaskFailed(url: task.url))) + return + } task.remove(completely: completely, onMainQueue: onMainQueue, handler: handler) } } diff --git a/Tiercel.xcodeproj/project.pbxproj b/Tiercel.xcodeproj/project.pbxproj index 571f2d4..9c20c34 100644 --- a/Tiercel.xcodeproj/project.pbxproj +++ b/Tiercel.xcodeproj/project.pbxproj @@ -559,7 +559,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 3.2.1; + MARKETING_VERSION = 3.2.2; PRODUCT_BUNDLE_IDENTIFIER = com.Daniels.Tiercel; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -589,7 +589,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 3.2.1; + MARKETING_VERSION = 3.2.2; PRODUCT_BUNDLE_IDENTIFIER = com.Daniels.Tiercel; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = "";