Search Unity

How to access file on Files App ios 11 or higher?

Discussion in 'iOS and tvOS' started by nandonandito, Jun 26, 2019.

  1. nandonandito

    nandonandito

    Joined:
    Nov 24, 2016
    Posts:
    43
    hi guys, i have question about how to access file apps folder on ios 11 or higher?
    so since ios 11, they are a files app folder. so in a my case i save some screenshot on that files app folder.
    so in my game i can import image from a picture folder, but now i would like to open image or file from a files app document folder on ios?
    like this, but this is for xcode tutorial. https://www.appcoda.com/files-app-integration/
    they can import file from a document on files apps folder.
    but i find on the internet, no one have this issues.
    hope you guys have that experience, and share it. thankyou.
     
    Last edited: Jun 26, 2019
  2. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
    If your goal is to "display the app in Files.app so that user can drop in files from other places and use it in the game", "UIFileSharingEnabled" and "LSSupportsOpeningDocumentsInPlace" are the only two Info.plist keys you'll need to make this work. Add these keys to Info.plist, either using Xcode after your iOS project is generated by Unity, or automating it with Unity Editor's Xcode API. You can then use "UnityEngine.Application.persistentDataPath" to access that directory.

    However, if your goal is to "display a file selector view controller in the Unity app", you'll need to extra steps described in the article you linked to. Plus, you'll need to define C functions to facilitate those Swift/Objective-C API in your C# code (https://docs.unity3d.com/Manual/PluginsForIOS.html). It's much more complicated.
     
  3. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Just wan to save a PDF file, but it does not work. There is no error when saving to Application.persistentDataPath, but there is no app's folder and obviously no PDF file on the Files app either.

    Any help is appreciated.
     
  4. Paul-Bones

    Paul-Bones

    Joined:
    Apr 4, 2016
    Posts:
    3
    Hello!
    I want the same as bakno, just save a PDF and see it in user's files folder.
    Did you finally found a solution?

    Thanks in advance.
     
  5. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    bumping this. I have the same requirement: being able to display a file selector in my Unity app to load from the ios Files App.