How to display sandboxed files using a UIDocumentPickerViewController?

288 views Asked by At

I am trying to display documents created by my app using the UIDocumentPickerViewController. Is this possible, or do I need to roll my own? Based on my research, it appears that this can't be done, but that seems like such an unnecessary restriction. An app should be able to access their documents easier than externally owned ones.

I do know of UIDocumentBrowserViewController, but in my app the user creates multiple documents in a single "session", meaning, popping back to the root browser would be jarring. For example, a document could potentially be created every 10 seconds, but normal usage would create a document every couple minutes. I get that UIDocument might not be the best case for this, and I have also built my model in Core Data, but learning of the iCloud Deprecation this morning, it seems that UIDocument is the best way to proceed.

So 3 questions I guess:

  1. Can UIDocumentPickerViewController display "app owned files"?
  2. Can UIDocumentBrowserVC create new docs, without popping?
  3. Is there a better API I am missing?

Thanks, Mikey

1

There are 1 answers

1
hidden-username On BEST ANSWER

For your documents to show up in the UIDocumentPickerViewController sharing needs to be enabled. The following keys need to be set in your info.plist

<key>UIFileSharingEnabled</key> <true/> <key>LSSupportsOpeningDocumentsInPlace</key> <true/>