Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

iOS files app with unity

Discussion in 'iOS and tvOS' started by stansison, Jun 24, 2019.

  1. stansison

    stansison

    Joined:
    Feb 20, 2016
    Posts:
    28
    This topic is really hard to find due to the name of apples Files app.

    I’ve been looking for a way to have my app works with the iOS Files app - access to Dropbox, iCloud Drive etc etc.

    I have been successful in accessing iOS application app folder but I would like to be able to get information and files outside of my app’s sandbox. The only files I can view and access are those within the app’s folder.
    I know Apple did this intentionally, so I would like to use apple’s files app to bridge the access. Is this possible?

    I’m hoping someone could point me in the right direction?
     
  2. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    513
    The easiest way would just to ask the user to drop whatever files they want to use into your app's sandbox, should you already added those two keys in your Info.plist.

    A better way (and much more complicated one) is to implement a UIDocumentPickerViewController in an Objective-C/Swift source file and turn it into a Unity plugin. Implementing that ViewController would allow user to pick a file (or multiple files if you set "allowsMultipleSelection" property to true) from whatever sources they have in Files.app and you'll receive the URL to their selection(s).

    Here's some relevant reading:
    1) https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller?language=objc
    2) https://docs.unity3d.com/Manual/PluginsForIOS.html
    3) https://www.appcoda.com/files-app-integration/
     
  3. stansison

    stansison

    Joined:
    Feb 20, 2016
    Posts:
    28
    Thank you! This is very much appreciated!