I have been learning about using the Keychain to store username and password combinations. I have the following method called "clear Password" but it seems to delete the entire keychain item for the account name:
-(OSStatus)clearPassword{
NSDictionary *query = @{ (__bridge id)kSecClass : (__bridge id)kSecClassGenericPassword,
(__bridge id)kSecAttrAccount : self.accountName};
CFDictionaryRef queryRef = (__bridge CFDictionaryRef)query;
OSStatus status = SecItemDelete(queryRef);
NSAssert(status == errSecSuccess || errSecItemNotFound, @"Unable to delete keychain item");
return status;
}
is it possible to delete JUST the password for a specific account Name so that I would keep the account name in the keychain with no password so that when the user goes to log in the app I can check if the accountname they entered is in the keychain already? If so how would I formulate the query Dictionary to accomplish this?
NSUserDefaults
, for example?). – Krumelur