Bookmarked URLs to security scoped resources cannot be resolved in app extensions

Originator:simonstoevring
Number:rdar://43055392 Date Originated:08-Aug-2018 08:14 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:12.0
Classification:Enhancement Reproducible:Always
 
Summary:
Bookmarked URLs to security scoped resources created with URL.bookmarkData() cannot be resolved in app extensions, e.g. an action extension or an intents extension. 

For a document-based app that has one or more app extensions, this poses an unfortunate limitation on the features the app can provide its users.
Imagine a document-based app that allows users to pick a directory to store the documents in using UIDocumentPickerViewController. When the user chooses a directory, e.g. a directory provided by a third-party file provider, the app creates a bookmark and stores it. The bookmark is used when creating new documents. If the app wants to access these documents in an app extension, it cannot do so, since the app extension cannot resolve the bookmark.

Steps to Reproduce:
1. Create a bookmark to a security scoped resource in an app. Store the bookmark data, e.g. in user defaults.
2. In an app extension, fetch the stored bookmark data and try to resolve it to a URL.
3. Step two fails because URL(resolvingBookmarkData:bookmarkDataIsStale:) throws an error.

Expected Results:
URL(resolvingBookmarkData:bookmarkDataIsStale:) should be able to resolve URLs to security scoped resources.

Actual Results:
URL(resolvingBookmarkData:bookmarkDataIsStale:) throws an error when attempting to resolve URLs to security scoped resources.

Version:
12.0

Notes:

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!