Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone keychain items persist after application uninstall?

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?

like image 655
Vladimir Avatar asked Sep 08 '10 20:09

Vladimir


People also ask

How do I delete app data from iPhone keychain?

Click Finder > Go > Utilities > Keychain Access. 2) In Keychain Access, select the Passwords category on the left to review the list of sites and services for which you've saved a password. 3) Right-click the service you want to edit/remove, then left-click Delete.

How do I reset my Xcode keychain?

Go to Keychain Access in the menu-bar and click Preferences. 6. Select "Reset My Default Keychain".


2 Answers

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.

like image 117
Sven Avatar answered Oct 04 '22 17:10

Sven


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.

like image 30
ForceMagic Avatar answered Oct 04 '22 18:10

ForceMagic