views:

150

answers:

1

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?

+1  A: 

Yes, this is the expected and correct behavior. The keychain is shared between applications, so another app could be using the same credentials. You should just leave the info alone when your app is removed.

Sven
So the fact that I don't want info stay in the keychain after app uninstall might imply that keychain is simply wrong place to store it, right?
Vladimir
From the docs: 'In iOS, an application always has access to its own keychain items and does not have access to any other application’s items.'
MihaiD