Cancelling an NSURLSession background download that was in progress when the app started causes all future downloads to fail when debugger is attached
| Originator: | chris.vig | ||
| Number: | rdar://24929645 | Date Originated: | 3/2/2016 |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | 9.2 |
| Classification: | Reproducible: | Always |
Summary:
If the app is started using the Xcode debugger, and recovers an in-progress download task from a background NSURLSession, cancelling the recovered task causes all future download tasks to either:
a) Hang forever and never actually progress or return any data
b) Fail immediately with an NSError with domain NSPOSIXErrorDomain and code 2 ("No such file or directory")
Steps to Reproduce:
1. Create an NSURLSession instance using a background NSURLSessionConfiguration object
2. Start an NSURLSessionDownloadTask using the background session
3. While the download is still in progress, close the app from Xcode, and then relaunch it from Xcode
4. Recover the in-progress download task using [NSURLSession getTasksWithCompletionHandler:]
5. Cancel the in-progress download task
6. Attempt to start a new download task
Expected Results:
The download should progress normally, including callbacks to URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:, and eventually complete successfully.
Actual Results:
The download will actually either:
a) Hang forever and never actually progress or return any data. None of the NSURLSessionDownloadDelegate methods are ever called.
b) Fail immediately (via a callback to URLSession:task:didCompleteWithError:) with an NSError with domain NSPOSIXErrorDomain and code 2 ("No such file or directory")
Both of the above appear to happen with essential equal frequency.
Version:
iOS 9.2
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!