I use NSURLSession downloadTaskWithURL: to upload a file and use NSURLSessionDownloadTask cancelByProducingResumeData:to create NSDataand save it in a local temp file.
Then I want to resume downloading with NSURLSession downloadTaskWithResumeData:.
There is a problem, the URL that I used to download the file is temp url, I need to request a new URL to download the same file. After using downloadTaskWithResumeData:it, it helps me create NSURLSessionDownloadTaskwith the same URL as before.
How do I replace the URL with the new URL I am requesting recently? Or how can I change the HTTP request of this NSURLSessionDownloadTask?
How do you deal with a situation that resumes NSURLSessionDownloadTaskwith a different URL?
I am going to get the .tmp file downloaded NSURLSessionand set Range in the HTTP header and then write the new temp url to this file.
source
share