UIDocument, FileWrapper & Third-Party File Providers

480 Views Asked by At

I use document packages in my application (via FileWrapper API) and I am using the UIDocumentBrowserViewController class for document management. The document package basically represents a hierarchy of (text) files and folders. Everything works just fine when the documents are stored on the device or in the iCloud. But things are different when I try to create a document in a remote location, access to which is provided by a third-party file providers, such as Google Drive, Microsoft One Drive or Dropbox. Every time I try to create a document in any of those locations my call to importHandler(fileURL, .move):

  1. Dropbox: fails with generic error message: "The operation couldn’t be completed. (DBFileProviderErrorDomain error 1.)";

  2. Google Drive: fails with a slightly different message: "The operation couldn’t be completed. (com.apple.DocumentManager error 1.)"

  3. MS OneDrive: appears to succeed but upon trying to open the newly created document the app is handed an OS_dispatch_data object instead of a FileWrapper object, which it is expecting.

I am not sure what’s going on. The only thing I can think of is that document packages are only supported on Apple file systems.

Any suggestion is greatly appreciated. Thank you.

1

There are 1 best solutions below

0
On

As far as I can tell (and confirming your suspicion), the file provider extensions for most non-iCloud cloud storage providers (accessed through a UIDocumentBrowserViewController) don't handle packages very well. UIManagedDocument objects, for instance, store their data stores in a package format, and my experience trying to create/save/move them to non-iCloud cloud storage using a UIDocumentBrowserViewController usually ended in failure. See the OpenRadar copy of the bug report I filed with Apple, http://openradar.appspot.com/6905951.