Is there a way to save app data between app installs and uninstall in iOS

I am developing an application that needs to run expensive calculations on startup. So, at the first launch of the application, the application performs calculations and saves the result in a file.

If the user decides to uninstall the application and reinstall it later, the calculations must be performed again, and I would like to avoid re-calculation. Please note that I'm not talking about application updates, but about uninstalling / reinstalling.

I was wondering if there is a way to keep data only available for my application, but which uninstalls can withstand.

The solution can be located inside the device (using the form of files / preferences / ...) or based on a server. For example, a possible solution might be to send the device identifier with the result to the server and save it there, but since the device identifier is deprecated in iOS 5, it is no longer a valid solution.

Thank you for your responses.

Jaime

+7
source share
5 answers

You do not say how much data, but the following options:

  • ICloud
  • trinket
  • Dropbox

The only “universal” option that all devices will have and that cannot be turned off is Keychain, although you are limited by the amount of space that you can use.

Personally, I did nothing. If the user uninstalls the application, I think it is a fair game to resell things upon reinstallation.

+9
source

The way I have achieved this today is a bunch of keys. Basically, anything that matches NSCoding can be stored in a keychain. It is a good idea to use the keychain sparingly, at least from the point of view of “good personal practice”. In the end, when it is in the keychain, it will exist until you delete it, and probably only your application will know the key that will be used to access the stored data.

A good starting point for implementing what stores data structures in a keychain can be found on the Use Your Loaf blog here by Keith Harrison.

Thus, this is the only transparent method that I know that can guarantee that the data will be saved after deletion. Other options, such as third-party repositories (Dropbox) or iCloud, rely on some level of user participation.

+4
source

Keep in mind that Apple wants it this way: deleting an application means deleting all the data in this application. I would rather have iCloud save a small amount of data.

+1
source

Let the user connect to their DropBox account, and you can save the data there - their API is very easy to use, and you don’t have to worry about how Apple can decide to save data in the future.

0
source

One option besides keychain and iCloud is the Apple UIPboardboard. Here is a link to the class. Some people find this unreliable, so it depends on how important it is to save data for you.

0
source

All Articles