简体   繁体   中英

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM