应用程序卸载后,iPhone 钥匙串项目仍然存在吗?
我正在玩 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,这是预期且正确的行为。
某些钥匙串项目可能与您控制的其他应用程序共享(共享相同的钥匙串项目访问组)。
当您的应用程序被删除时,您应该只保留该信息。您没有在删除应用程序时删除钥匙串项目的回调或方法。
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.
编辑:
他们最终恢复了我的答案中描述的行为,因此,在每个人都放弃该版本范围之前,这种情况应该不会再发生。
不幸的是,情况不再是这样了。自 iOS 10.3 以来已发生变化。
请参阅此处的参考。
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.
See the reference here.