AnsweredAssumed Answered

How to delete settings json file from within app, particularly from iOS?

Question asked by paul.haakma on Sep 7, 2015
Latest reply on Sep 15, 2015 by SSuresh-esristaff

Hi all,


Does anyone know how to delete the settings json from within the app while it is running, in particular on iOS? This file is stored at the path identified by: app.settings.path but the following code won't delete it:



function deleteAllSettingFiles(){

            console.log("TRYING TO DELETE THE SETTINGS FILE....")   //gets to here fine

            var filesList,  file, index, success, report

            filesList = settingsFolder.fileNames("*", false)

            for ( index in filesList){

                file = filesList[index]

                console.log("going through all the settings files... ", file)  //never gets this far...

                if (settingsFolder.fileExists(file)){

                    success = settingsFolder.removeFile(file);

                    report = file + " deleted? " + success


                }          }       }


I assume it is either because the file is locked since the app is using it, or the app doesn't have permissions to delete it. In Windows you can manually delete this file outside of the app, on Android you can 'clear the cache' of an app, but on iOS there is no OS method that I'm aware of that will clear this file except for completed uninstalling this file altogether.


The other alternative is to stop using the settings file, and instead implement my own settings file in a location that I control, but it seems a bit counterintuitive to having the app.settings file.


Any ideas?