Document Picker sometimes returns an URL that is not accessible because access is denied by the sandbox

Originator:lextar
Number:rdar://19427991 Date Originated:09-Jan-2015 07:45 PM
Status:Duplicate of 18359795 (Closed) Resolved:
Product:iOS Product Version:8.1.2
Classification:Other Bug Reproducible:Sometimes
 
Summary:
Sometimes when the user picks a file from the iOS 8 document picker, access to the returned URL is denied by the iOS sandbox. This results in an error message "The operation could not be completed (Cocoa Error 256)" when trying to open it using a UIDocument subclass.

Steps to Reproduce:
- Use the "Open…" menu in my app "Textastic Code Editor" - This opens a UIDocumentMenuViewController in Open mode
- From the popover, choose a storage provider like "Transmit" or "Working Copy"
- Choose a file to open


Expected Results:
It should open the file without problems.


Actual Results:
Most of the time this works, but sometimes this error comes up: "The operation could not be completed (Cocoa Error 256)"

In this case, I see a message like this on the console:

kernel[0] <Notice>: Sandbox: Textastic(279) deny file-read-data /private/var/mobile/Containers/Shared/AppGroup/BE887E37-0BF9-42FF-B6FC-1DF144991B91/File Provider Storage/RemoteDocuments/65FFA056-36DC-4F5E-BC38-8F20EE112FAD/home/blachio/public_html/atom.xml


Regression:
I haven't found a pattern when exactly it happens. It happens with different file providers (at least Transmit and Working Copy). 


Notes:
In my app, I'm just creating a new UIDocument with the URL I get in documentPicker:didPickDocumentAtURL: - this should handle security-scoped bookmarks correctly. The sandbox should not deny access.

I've attached two log files:

not_working.log: This log shows the failure case. In line 25 you see the sandbox deny file-read-data notice from the kernel.
working.log: This is a console log that shows the case where the same file is opened successfully.

The log files also contain NSLayoutConstraint warnings - those only seem to happen on iPad and seem to be cause by the document picker UI.

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!