iPhone NSKeyedArchiver - 通过 AppStore 更新应用程序后,用此类保存的数据仍然存在吗?

发布于 2024-08-23 06:56:09 字数 227 浏览 3 评论 0原文

我是 iPhone 开发的新手,我想知道我是否会使用 NSKeyedArchiver 保存一些数据(NSSDictinary),数据在通过 AppStore 更新我的应用程序后仍然存在? 假设我想为用户保存我的应用程序的通行证,并且这些信息可能会保存到应用程序文件夹中。如果我使用 iTunes 通过 AppStore 更新应用程序,保存的旧数据仍然存在?用户会发现他保存的数据登录凭据?

谢谢,

亚历克斯。

I am a newbie in the iPhone dev and I want to know if I will save some data(NSSDictinary) with NSKeyedArchiver, tis data persist after an update process of my app via AppStore?
Let's say that I want to save user an pass for my app and probably this information will be saved into the app folder.If I will update the app via AppStore with iTunes, the old data saved are still there?The user will find his saved login credentials?

Thanks,

Alex.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

听闻余生 2024-08-30 06:56:09

只需确保将数据保存到应用程序的文档目录(使用 NSKeyedArchiver archiveRootObject:toFile:)。

应用程序更新期间保存的文件
更新应用程序取代
之前的申请与新的申请
由用户下载。在此期间
过程中,iTunes 安装更新的
在新应用程序中应用
目录。然后它会移动用户的
旧安装中的数据文件
转到新的应用程序目录
在删除旧安装之前。
以下目录中的文件是
期间保证被保存
更新流程:

/文件
/图书馆/首选项
尽管文件在其他用户中
目录也可以移动,
你不应该依赖他们
更新后出现。

获取应用程序目录的路径

Just make sure you save the data to the app's document directory (using NSKeyedArchiver archiveRootObject:toFile:).

Files Saved During Application Updates
Updating an application replaces the
previous application with the new one
downloaded by the user. During this
process, iTunes installs the updated
application in a new application
directory. It then moves the user’s
data files from the old installation
over to the new application directory
before deleting the old installation.
Files in the following directories are
guaranteed to be preserved during the
update process:

/Documents
/Library/Preferences
Although files in other user
directories may also be moved over,
you should not rely on them being
present after an update.

Getting Paths to Application Directories

谁与争疯 2024-08-30 06:56:09

您应该使用 NSUserDefaults 来存储此类设置。它将信息写入一个目录,该目录将在同步、恢复备份和应用程序升级时保留。

或者,您可以使用钥匙串来存储用户名/密码。这更安全,并且它也将在应用程序更新或同步/恢复备份后继续存在。

You should use the NSUserDefaults to store such settings. It will write the information to a directory that will be preserved accross syncing, restoring a backup and application upgrades.

Alternatively you can use the Keychain to store the username/password. This is more secure, and it will also survive application updates or syncing / restoring a backup.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文