Reputation: 383
I would like to know if I can retrieve the parial downloadede data of a failed NSURLSessionDownloadTask.
My use case is:
My question is: is it possible to retrieve the downloaded 512MB using the NSURLSession APIs with a background session?
Thanks,
Upvotes: 1
Views: 1255
Reputation: 2294
Further to the answer already posted (and expanding on it), you can access the data already downloaded via the error
object itself, as follows:
NSData* resume_data = error.userInfo[NSURLSessionDownloadTaskResumeData];
Upvotes: 1
Reputation: 21
Apple Documentation States:
If a transfer fails, the session object provides an NSError object either to your delegate or to the task’s completion handler. In that object, the NSURLSessionDownloadTaskResumeData key in the userInfo dictionary contains a resumeData object.
Upvotes: 2