I submitted a bug report: rdar://32912183

Based on the WWDC video, it appears Apple is recommending you put an empty 
document as a resource in your app and then choose the option to copy it. 

The other option would be to make a new document in a temporary directory your 
app can write to and then in the completion handler of closing it, call the 
importHandler and tell it to copy it.

My understanding is the UIDocumentBrowserViewController is running in a 
different process and your app may not have access to the chosen directory 
normally (as it may not be in your app's sandbox) so you can't just create a 
file there. Instead, you need have a document your app can access and tell the 
importHandler to copy or move it to the location the user picked.

HTH,
Dave Reed



> On Jun 21, 2017, at 5:08 PM, Jonathan Hull <jh...@gbis.com> wrote:
> 
> That part is really confusing me as well (I am also using a package 
> document).  I started by using the documents directory, but I keep getting an 
> error that the browser doesn’t have access.  Then I switched to the temp 
> directory, and now it works part of the time, and the other times I still get 
> the same error.
> 
> Where are we supposed to create our package?  Does the browser copy it to a 
> specific place? or do we need to copy it?
> 
> Here is the error:
> [ERROR] Could not get attribute values for item file:<File Path Here>. Error: 
> Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not 
> permitted to access the URL."
> 
> Thanks,
> Jon
> 
> 
>> On Jun 21, 2017, at 5:41 AM, davel...@mac.com wrote:
>> 
>>> 
>>> On Jun 20, 2017, at 5:29 PM, Kyle Sluder <k...@ksluder.com> wrote:
>>> 
>>> On Tue, Jun 20, 2017, at 03:40 PM, davel...@mac.com wrote:
>>>> I'm trying out the new UIDocumentBrowserViewController in iOS 11 (using
>>>> the iPad simulator). I can get it to create a new document (which is a
>>>> file package) for my app, but tapping on the document in the
>>>> UIDocumentBrowserViewController does not cause the delegate method
>>>> documentBrowser(_ controller: UIDocumentBrowserViewController,
>>>> didPickDocumentURLs documentURLs: [URL]) to get called.
>>>> 
>>>> It does get called for another document type that is a flat file (not a
>>>> file package), but it doesn't work with the file package document created
>>>> by NSFileWrapper.
>>>> 
>>>> Am I doing something wrong or is this a bug with file packages?
>>> 
>>> Please file a bug report and send me the number so I can ensure the
>>> correct team sees it.
>>> 
>>> Thanks,
>>> --Kyle
>>> 
>>>> 
>>>> Thanks,
>>>> Dave
>> 
>> I have one more idea to try and then if that doesn't work, I'll try to make 
>> a small sample project today and submit the bug report (and I'll email you 
>> the #).
>> 
>> The one thing I'm not certain about is the WWDC video shows making an empty 
>> file and adding it to the project as a resource and then copying it when the 
>> new document button is pressed. Do I just need to make an empty directory 
>> for that? My idea was to create an empty document with my app (in the 
>> simulator) and then copy that empty document directory to the Xcode project. 
>> Are there any special flags/attributes that need to be set on that directory 
>> to make it a correct package?
>> 
>> Thanks,
>> Dave Reed
>> 
>> 
>> 
>> _______________________________________________
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
>> 
>> This email sent to jh...@gbis.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to