Rev
Rev

Reputation: 57

IOS: Data persistence between versions of the app

I cannot find any information on topic: what is happening when I release new version of iOS application on iTunes? Is older version on device completely replaced? Or there is a persistence of Documents folder? Is it possible to make update to be like a "clean" installation?

Upvotes: 0

Views: 748

Answers (2)

rebello95
rebello95

Reputation: 8576

When you release an update to your iOS app and the user installs it, the system does not wipe out any data from within the app.

This means that data in a given user's Documents directory, NSUserDefaults, as well as the keychain will persist between app updates.

A couple of important notes, however:

  1. The Caches directory of an app is never reliably persisted, so if you want to make sure data stays safe, don't put it in this directory
  2. Items in the keychain seem to persist even if you completely erase the app and re-install it. I've noticed this in the past, so it may be a good thing to keep in mind

In short, if you want data cleaned out of your app on each update (not sure why you would), you'll have to do so manually.

Upvotes: 4

Quentin Hayot
Quentin Hayot

Reputation: 7876

Your Documents folder will not be cleaned.
If you want to clear it, make sure to do it programmatically in your new release.

The Documents folder is deleted only when the user deletes the app.

Upvotes: 1

Related Questions