When the app is deleted what happens to the values

2019-04-07 20:03发布

问题:

I have a little question regarding NSUserDefaults. When the application is deleted, what happens to the values stored in the NSUserDefaults? Do they get deleted as well?

When I remove a app and reinstall it from the app store the previous NSUserDefaults values are loaded?

回答1:

When an app is deleted from the device all local data associated with the app will be deleted too. This includes NSUserDefaults. However any data stored at an online service won't. For example, iCloud. The app will just fetch the data again if requested to do so by the user / developer.

Edit

As per mAu's comment below - this includes keychain data, which won't be deleted either.