From 0c19b4bc4fac0fda17f331fcc33082f7bb284d4d Mon Sep 17 00:00:00 2001 From: lijl02 Date: Thu, 22 Aug 2019 12:04:30 +0800 Subject: [PATCH] FIX: fix download resume path bug Change-Id: I4f8e7c8c9f176c6957e2c82611e180ea50311530 --- YTKNetwork.podspec | 2 +- YTKNetwork/YTKNetworkAgent.m | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/YTKNetwork.podspec b/YTKNetwork.podspec index b233b76..dcb50b4 100644 --- a/YTKNetwork.podspec +++ b/YTKNetwork.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "YTKNetwork" - s.version = "2.0.5" + s.version = "2.0.6" s.summary = "YTKNetwork is a high level request util based on AFNetworking." s.homepage = "https://github.com/yuantiku/YTKNetwork" s.license = "MIT" diff --git a/YTKNetwork/YTKNetworkAgent.m b/YTKNetwork/YTKNetworkAgent.m index 72ffff9..9345037 100644 --- a/YTKNetwork/YTKNetworkAgent.m +++ b/YTKNetwork/YTKNetworkAgent.m @@ -382,7 +382,10 @@ - (void)requestDidFailWithRequest:(YTKBaseRequest *)request error:(NSError *)err // Save incomplete download data. NSData *incompleteDownloadData = error.userInfo[NSURLSessionDownloadTaskResumeData]; - NSURL *localUrl = [self incompleteDownloadTempPathForDownloadPath:request.resumableDownloadPath]; + NSURL *localUrl = nil; + if (request.resumableDownloadPath) { + localUrl = [self incompleteDownloadTempPathForDownloadPath:request.resumableDownloadPath]; + } if (incompleteDownloadData && localUrl != nil) { [incompleteDownloadData writeToURL:localUrl atomically:YES]; }