NSURLSessionDownloadTask cancelByProducingResumeData return null

落爺英雄遲暮 提交于 2019-12-06 12:54:10

问题


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?


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!