Security-scoped URL cannot be resolved if the app that provided the file is deleted from the device

Originator:lextar
Number:rdar://22479936 Date Originated:28-Aug-2015 09:06 PM
Status:Open Resolved:
Product:iOS Product Version:8.4.1
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
My app supports the iOS 8 document picker (UIDocumentMenuViewController) in open mode (UIDocumentPickerModeOpen). If the user opens a file using the document picker, the app saves a security-scoped bookmark in order to show it in a list of recently opened files.

If the user then deletes the app that provided the file, the security-scoped bookmark cannot be resolved anymore. Instead, the method +[NSURL URLByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:]  never returns.

Steps to Reproduce:
1. Use the "Open…" command in the app Textastic for iPad to open the README.md file from the example repository in the app "Working Copy"
2. Close the file in Textastic or open another local file
3. Delete the file provider app "Working Copy" from the device
4. Open the Recent Files list in Textastic

Expected Results:
The list of recent files in Textastic should open.

Actual Results:
Textastic hangs in a call to +[NSURL URLByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:]

Regression:
If you reinstall the file provider app (Working Copy), it does not hang anymore.
A reboot of the device does not fix the problem.

Notes:
I have attached a screenshot of the call stack. The app hangs in dispatch_semaphore_wait_slow

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!