downloadTaskWithResumeData crashes if the temporary download file has been deleted

Originator:padraig.kennedy
Number:rdar://15899495 Date Originated:23-Jan-2014 08:43 PM
Status:Closed Resolved:03-Jun-2014
Product:iOS SDK Product Version:7.0.4
Classification:Crash Reproducible:Always
 
Summary:
Calling "downloadTaskWithResumeData" on an NSURLSession where the resume data references a temp file that no longer exists causes a crash.  The temporary file can be cleared out by iOS at any time.

Steps to Reproduce:
1. Begin a download on an NSURLSession.
2. Cause it to fail half way through (turning on Airplane mode is a handy way to do this) and save the resumeData is generated in the didCompleteWithError delegate method.
3. Manually clear the /Library/Caches/com.apple.nsnetworkd/ folder.
4. Try to resume the download with the resumeData.

Expected Results:
The download should begin from 0 if the file does not exist any more or at worst, the task should return nil. 

Actual Results:
It crashes.

iOS itself can clear the temporary files any time to recover space, so the app has no control over the lifetime validity of resumeData.

Version:
Happens on iOS 7.0.4 and iOS 7.1b4 

Notes:


Configuration:
iPhone

Attachments:

Comments

We believe this issue has been addressed. Please verify with iOS 8 beta (Build 12A4265u) release, and reply back with your results.

iOS 8 beta (Build 12A4265u) https://developer.apple.com/devcenter/ios/index.action Posted Date: June 2, 2014

If this issue is still occurring, please include any relevant logs, and or a test case with your update.

Logging Instructions/Test Case Requirements: https://developer.apple.com/bug-reporting/ios/

By padraig.kennedy at July 31, 2014, 4:24 p.m. (reply...)

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!