I use NSURLSessionDownloadTask to download a file from server, it is run in a background session. I want to save resume data to resume the download when the app is terminated. However, the call of cancelByProducingResumeData always returns null. I cannot figure out the issue, cause I used to do a sample of resumable download task successful before. Does anybody get the same issue?
Do you know if the request satisfies the criteria outlined in the documentation for the cancelByProducingResumeData
method?
A download can be resumed only if the following conditions are met:
- The resource has not changed since you first requested it
- The task is an HTTP or HTTPS GET request
- The server provides either the ETag or Last-Modified header (or both) in its response
- The server supports byte-range requests
- The temporary file hasn’t been deleted by the system in response to disk space pressure
来源:https://stackoverflow.com/questions/24215610/nsurlsessiondownloadtask-cancelbyproducingresumedata-return-null