Ios – iphone keychain items persist after application uninstall

iosiphonekeychainobjective c

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?

Best Answer

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.