Store user settings on ios/android



Where do you save user settings on mobile platforms.

I tried using ApplicationProperties but the PropertiesFile::Options::getDefaultFile() does not seem to work on ios/android

Any ideas on this?






Could you please tell us a bit more precisely what does not work? Do you get an invalid file back, or are you having some other error?


Sorry about that.

What I want to do is store some simple user settings x-platform.

I thought that a quick fix would be to use the PropertiesFile::Options::getDefaultFile()  to get a file on all platforms.

But I hit a jassert in Xcode when compiling for ios:

    if (osxLibrarySubFolder != "Preferences" && ! osxLibrarySubFolder.startsWith ("Application Support"))


        /* The PropertiesFile class always used to put its settings files in "Library/Preferences", but Apple

           have changed their advice, and now stipulate that settings should go in "Library/Application Support".

           Because older apps would be broken by a silent change in this class's behaviour, you must now

           explicitly set the osxLibrarySubFolder value to indicate which path you want to use.

           In newer apps, you should always set this to "Application Support"

           or "Application Support/YourSubFolderName".

           If your app needs to load settings files that were created by older versions of juce and

           you want to maintain backwards-compatibility, then you can set this to "Preferences".

           But.. for better Apple-compliance, the recommended approach would be to write some code that

           finds your old settings files in ~/Library/Preferences, moves them to ~/Library/Application Support,

           and then uses the new path.



        dir = dir.getChildFile ("Application Support");



There as a member variable in Option called osxLibrarySubFolder (see here) that you should set, as per the comment above the assertion :)

Hope this helps!