ios 应用程序卸载后,iphone 钥匙串项目仍然存在?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3671499/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iphone keychain items persist after application uninstall?
提问by Vladimir
I am playing with idandersen's scifihifi-iphonecode for keychain and came across the following behavior - I set the password using, say
我正在使用 idandersen 的scifihifi-iphone钥匙串代码并遇到以下行为 - 我使用设置密码,说
[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?
然后从设备中删除测试应用程序并重新安装 - 先前设置的密码似乎保留在钥匙串中......
这是预期的行为吗?有没有办法确保我设置的密码会随应用程序一起删除?
采纳答案by Sven
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.
当您的应用程序被删除时,您应该只留下这些信息。在删除您的应用程序时,您没有删除钥匙串项目的回调或方法。
回答by ForceMagic
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.
不幸的是,情况不再如此。自 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.
这是 iOS 10.3 中为保护用户隐私而有意进行的更改。在创建它的应用程序被删除后,可以识别用户的信息不应留在设备上。
应用程序创建的钥匙串项目在应用程序被删除时仍然存在,这从来不是 API 合同的一部分。这一直是一个实现细节。
See the reference here.