应用程序卸载后,iPhone 钥匙串项目仍然存在吗?

发布于 2024-09-18 11:02:37 字数 425 浏览 7 评论 0原文

我正在玩 idandersen 的 scifihifi-iphone 钥匙串代码,并遇到了以下行为 - 我使用设置密码,

[SFHFKeychainUtils storeUsername:@"User" andPassword:@"123"
                  forServiceName:@"TestService" updateExisting:YES error:&error];

然后从设备中删除测试应用程序并再次安装 - 之前设置的密码似乎保留在钥匙串中...
这是预期的行为吗?有没有办法确保我设置的密码将随应用程序删除?

I am playing with idandersen's scifihifi-iphone code for keychain and came across the following behavior - I set the password using, say

[SFHFKeychainUtils storeUsername:@"User" andPassword:@"123"
                  forServiceName:@"TestService" updateExisting:YES error:&error];

Then delete test application from device and install it again - the previously set password appears to remain in keychain...
Is it the expected behavior? And is there a way to make sure that password I set will be deleted with the application?

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

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

发布评论

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

评论(2

遗心遗梦遗幸福 2024-09-25 11:02:37

是的,这是预期且正确的行为。

某些钥匙串项目可能与您控制的其他应用程序共享(共享相同的钥匙串项目访问组)。

当您的应用程序被删除时,您应该只保留该信息。您没有在删除应用程序时删除钥匙串项目的回调或方法。

Yes, this is the expected and correct behavior.

Some keychain items may be shared with other apps you control (that share the same keychain item access group).

You should just leave the info alone when your app is removed. You have no callback or method of removing the keychain items on deletion of your app.

南七夏 2024-09-25 11:02:37

编辑:
他们最终恢复了我的答案中描述的行为,因此,在每个人都放弃该版本范围之前,这种情况应该不会再发生。

不幸的是,情况不再是这样了。自 iOS 10.3 以来已发生变化。

这是 iOS 10.3 中为了保护用户隐私而特意进行的更改。创建用户的应用程序被删除后,可以识别用户身份的信息不应留在设备上。

钥匙串项从来都不是 API 合约的一部分
当应用程序被删除时,由应用程序创建的内容将继续存在。这有
始终是一个实现细节。

请参阅此处的参考

Edit:
They finally reverted the behavior described in my answers, so until everybody move away from that range of versions, this should not happen anymore.

Unfortunately, this is not the case anymore. It has been changed since iOS 10.3.

This is an intentional change in iOS 10.3 to protect user privacy. Information that can identify a user should not be left on the device after the app that created it has been removed.

It has never been a part of the API contract that keychain items
created by an app would survive when the app is removed. This has
always been an implementation detail.

See the reference here.

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