I’m not sure that you can actually “remove” items from the keychain. That’s the point of it - to save items so that they persist between app launches.
If you want to delete a SecItem (secure item), the method to use is: func SecItemDelete(_ query: CFDictionary) -> OSStatus
Got it working very easily. The one thing I can’t understand is why the code looks for a key of “v_Data” when checking the password. Is this something that is hard-coded in the KeyChain?
How to get the password of each KeychainWrapper if I have multiple passwords? Using the “v_Data” just giving me the last written password to Keychain. Thanks!
// Implement the mySetObject:forKey method, which writes attributes to the keychain:
- (void)mySetObject:(id)inObject forKey:(id)key
{
if (inObject == nil) return;
id currentObject = [_keychainData objectForKey:key];
if (![currentObject isEqual:inObject])
{
[_keychainData setObject:inObject forKey:key];
[self writeToKeychain];
}
}
The question is:
Why we’re using MyKeychainWrapper.writeToKeychain() method if the method mySetObject(id:forKey) save it inside of his implementation?
Is there any particular reason why we’re saving again?
This tutorial was pretty good, thanks for sharing the knowledge.
I don’t think that there is. It would be mentioned in the developer documentation. Touch ID works no matter what fingerprint is stored. If more than one is store, they would all authenticate the app
Great writeup Quick question, I understand “v_Data” is a key in the keychain Item Data, Do you have a list of keys or the choices of keys and their use? I’m sort of confused on that. Can you forward me to the apple documentation? I tried looking for “v_Data” but cannot find any explanation on that or any other keys.
What is not working for you? One thing I had to do myself, was enable the KeyChain Sharing entitlement. It doesn’t seem to writeToKeychain() in iOS 10 without it.