Simplest Way to Expose Files in iOS 11

I've got an app that is currently saving audio files (wav) in its documents directory. My goal is to make the audio files available to the files app should somone want to browse them and open them in other compatible applications.


What is the simplest way to expose these files to the file app?


Both of these options work:

- I can set UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace both to yes

- I can set UISupportsDocumentBrowser to yes


But not sure this is the correct option since it's not a document based app nor does it open these types of documents.


There also appears to be an activity type in iOS 11 for sending to the files app. I could do that from within the app, but seems like there is a simpler way.

Replies

Did you reach any conclusions on this topic? I am just starting to explore this question and am looking to see what others have learned.

I have a similar question: I want my app to access files from the Files app in two different ways:

  1. from my App: I use a UIDocumentPickerViewController to access files from different cloud services. I set the view controller with the UIDocumentPickerModeImport mode, to ensure that I get a copy of those files in my app's tmp/ directory which I can directly read in the callback didPickDocumentsAtURLs
  2. from Files: I define the supported document type for my App with CFBundleDocumentTypes in my Info.plist. With this, I can go in Files, select a proper file, click the share icon, and I will be given the option to 'Copy to MyApp'. This then makes a copy to my app's tmp/ directory and forwards the url to the AppDelegate through didFinishLaunchingWithOptions or openUrl.


All this worked great, really happy about it. But I got a new requirement that messes it up :

  • I want to ship example data with the app.
  • To do so, I download them to the Documents directory from a remote server.
  • I want those to be accessible from the Files app directly, to simplify the user experience by only offering one interface for loading data.
  • To have those files in the app's Documents directory visible, I have to set either:
  • Doing this works great for my local documents: I can open them directly from Files or from the App, as they appear in the 'On My iPhone' location
  • Doing this does not impact #1 above, since those files are imported to the tmp/ directory
  • Doing this BREAKS #2 above, since the files are not copied to the app tmp/ directory anymore, but the cloud url (from which I can not read the data) is directly used since the documents are opened in place.


Any suggestions on how I can import/copy data from the Files app to my app like it does by default, while also being able to expose my app's documents in the Files app?