Search Unity

How are iOS developers creating simple read only config text files?

Discussion in 'iOS and tvOS' started by eco_bach, Mar 23, 2017.

  1. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Mostly developed for Android so was not familiar with the limitations of Apple's sandboxing in iOS.

    So I simply need to create an editable text (or xml or json) config file that gets loaded and parsed by my iOS app when it starts. What is the best solution for this?
    In order for this config file to be included with the app when it compiles, do I need to store it in StreamingAssets or?
    And lastly, how do I edit this file on the actual device?
    Any help appreciated!
     
  2. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,305
    yes you can read it from StreamingAsstes:
    Code (CSharp):
    1. var filepath = Path.Combine(Application.streamingAssets, "youfilename");
    2. var lines = File.ReadAllLines(filepath);
    3.  
    the above will read its content (untested)
    test writing yourself - but its normal member of a filesystem which is accessible, so I see no reason writing to it would not work, too
     
  3. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Are you asking about editing your app's config file on the device using another app, i.e. a dedicated text editor app?
     
  4. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Thanks.
    And andymads, Yes, if that is an option . However my understanding is that because of sandboxing, it isn't possible to view any text file associated with an iOS app. Something quite simple with Android. Am I mistaken?
     
  5. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Sorry I don't have experience of this but you could try asking on stackoverflow.
     
  6. anngrant

    anngrant

    Joined:
    Aug 15, 2016
    Posts:
    14
    When it comesto creating apps for IOS, I an recommend you to try service of Wezom Studio . Almost all the customers have gone mobile and any business without a mobile presence is missing out on business opportunities. So you are moving in the right direction:)
     
  7. Parisai

    Parisai

    Joined:
    Feb 17, 2020
    Posts:
    1
    The demo trading account IOS gives you the freedom to move - you are no longer connected to your desktop and can fully trade with smartphones and tablets. Web Platform - gives you even more freedom and lets you work from any web browser on any device. Choose the Easiest Way - You now have many options for a 24-hour market stay!