I am developing an application that needs to perform expensive calculations at start up. So, the first time the application runs, the application do the calculations and store the result in a file.
If the user decides to uninstall the application and to re-install it later, the calculations have to be done again and I would like to avoid to re-calculate. Notice that I am not talking about updates of the application but about uninstall / re-install.
I was wondering if there is a way to persist data accessible only for my application but that can survive uninstalls.
The solution can be inside the device (using kind of files / preferences / ...) or based in a server. For example, a possible solution could be to send the device id with the result to a server and to store it there, but as the device id has been deprecated in iOS 5, is not a valid solution anymore.
Thank you for your answers.
Jaime
You don't say how much data, but the following would be options:
The only "universal" option, that all devices will have and that cannot be disabled, is the Keychain though you are limited by the amount of space you can use.
Personally, I would do nothing. If the user deletes the app I think it's fair game to have to recompute stuff on reinstallation.
The way I have achieved this to date is with the keychain. Basically anything that complies to NSCoding can be stored in the keychain. It's a good idea to use the keychain sparingly even if only from a 'good personal practice' standpoint. After all once it's in the keychain it is there until you specifically delete it and presumably only your app will know the key to use to access the data you store.
A really good starting point for implementing something which stores data structures into the keychain can be found on the Use Your Loaf blog here by Keith Harrison.
In summary, this is the only transparent method I know of that can guarantee persistence of data past an uninstall. Other options such as 3rd party repositories (Dropbox) or iCloud do rely on some level of user participation.
Keep in mind, that Apple wants it this way: removing an app means removing all data of this app. I would prefer iCloud to save small amount of data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With