What happens to application data when I update vs uninstall an iOS app?

When I update my apps on iOS the configuration for the apps are always maintained, including passwords. I am wondering someone knows if the data is kept when I (as end-user) uninstall apps as well.

The questions here are:

  • Is the Update on iOS actually is an uninstall and then install or really a different operation than uninstall?
  • Is there a real uninstall or is it simply a delete?

Given that the app provider is not capable to distinguish between end-user uninstall and update, how is the configuration data expected to be secured?


Solution 1:

It's a delete and re-install. A new copy is downloaded from the AppStore, and the actual application file is deleted off the device, and then re-copied. It's the same operation as when you uninstall, just with an immediate install.

The data for the application is kept separately, and when you choose to delete an application via the springboard, it will prompt you to delete the data associated with the application.

When updating, it is assumed that you want to keep this data, and it is also part of the backup that is made when the device is backed up.

Solution 2:

User data is kept in very specific areas on iOS apps, and there are further areas (cache and tmp) where data can be stored temporarily which can be recreated on the fly (or by redownload) if required. Until iOS5 an update via the App Store would be a full reinstall, effectively, but preserving the user data area so that your updated Angry Birds would retain your high scores etc. Delete the app, however, and you delete these user areas as well, as they are unable to exist outside of the app (they are sandboxed, and not available via a filesystem like mechanism etc.

To secure these areas, backup via iTunes. The App (or the latest binary version of it) is stored as well as the user data. It's possible to download an app, create some data, back it up, remove teh app & data, then update the app from within iTunes without installing it on your phone, and then add the app back into your sync list, at which point it will push over the new binary and repopulate teh user areas with your saved data.

I believe from iOS 5onwards a "delta" upgrade is possible, whereby rather than reinstall the whole app over the top (retaining user data) you only download the bits that have changed, but I cannot find the exact details right now. Certainly future OS updates will happen in this way, and I am sure it was coming if it has not already come to app store downloads, both on the Mac and iOS app stores.