Hi All,
I'm working on the download infrastrture of my company's app.
In the app, the user can download videos to watch offline and these are large downloads (>~1GB).
Beacuse of this, we want our download experience to be as smooth as it can be.
There is one scenario I'm really having trouble with:
If the user kills the app while downloading, the downloads stop.
On the next luanch we call getTasksWithCompletionHandler to catch all the lost download task.
We create a new task from the old one's reasumeData and resume it immediately.
like so:
if (task.error && task.error.code == -999 && task.error.userInfo[NSURLSessionDownloadTaskResumeData] != nil) {
task = [urlSession downloadTaskWithResumeData:task.error.userInfo[NSURLSessionDownloadTaskResumeData]];
[task resume];
}The new task will end with immediately with the error: NSPOSIXERROR Code=2
This happend on both the simulator and on a real iphone, both running iOS 11.
Please help me, I have no idea what to do.
Thank you.