iphone keychain items persist after application un

2019-01-07 06:51发布

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?

2条回答
疯言疯语
2楼-- · 2019-01-07 07:23

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.

查看更多
混吃等死
3楼-- · 2019-01-07 07: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.

查看更多
登录 后发表回答