存储在NSUserDefaults中的数据是否会通过应用程序更新和应用程序重新安装(删除安装)持续存在? [英] Is data stored in NSUserDefaults persists through application updates and on application reinstallation (remove-install)?

查看:674
本文介绍了存储在NSUserDefaults中的数据是否会通过应用程序更新和应用程序重新安装(删除安装)持续存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这对我的应用程序很重要,因为我想在那里存储应用程序UDID,Apple建议从iOS 5.0开始创建应用程序特定的UDID。

It's important to my app, becuase I want to store app UDID there, and Apple recommends to create app specific UDID starting from iOS 5.0.

推荐答案

用户默认值通过更新保留,但不会通过删除和重新安装应用程序来保留。目前,通过删除和重新安装应用程序来保持钥匙串,但它没有记录为一种或另一种方式,因此依赖此行为可能存在风险。

User defaults are persisted through updates but are not persisted through deleting and re-installing the app. At present, the keychain is persisted through deleting and re-installing the app, but it's not documented to be one way or the other, so relying on this behavior may be risky.

您还可以将值写入iCloud键/值存储区。这将在该用户的应用程序的所有安装中保留,并且是它的设计类型。

You could also write the value to the iCloud key/value store. That will be persisted across all installations of the app for that user and is kind of what it was designed for.

这篇关于存储在NSUserDefaults中的数据是否会通过应用程序更新和应用程序重新安装(删除安装)持续存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆