I use NSURLSession downloadTaskWithURL
: to download a file, and use NSURLSessionDownloadTask cancelByProducingResumeData:
to produce an NSData
and save it to a local temp file.
Then I want to resume the download task by using NSURLSession
downloadTaskWithResumeData:
.
There's a problem, the URL I used to download the file is a temp url, I need to request a new URL to download the same file.
After using downloadTaskWithResumeData:
, it helps me to create a NSURLSessionDownloadTask
with the same URL as before.
How can I replace the URL with the new URL that I newly request?
Or how can I change the HTTP Request of this NSURLSessionDownloadTask
?
How do you deal with the situation that resume a NSURLSessionDownloadTask
with a different URL?
I'm thinking about to get the .tmp file that NSURLSession
downloaded, and set the Range in HTTP Header, then write to this file with the new temp URL.