I have the following code:
NSData *secret = [pssword dataUsingEncoding:NSUTF8StringEncoding];
query =@{
(__bridge id)kSecClass:(__bridge id) kSecClassGenericPassword,
(__bridge id)kSecAttrService:@"My App",
(__bridge id)kSecAttrAccount:usrid,
(__bridge id)kSecValueData:secret
};
OSStatus status = SecItemAdd((__bridge CFDictionaryRef) query, NULL);
if(status != errSecSuccess)
{
NSLog(@"Unable add item with key =%@ error:%ld",secret,status);
}
It seem that the password and userid, is only saved for the session. Every time I refresh the simulator or re-launch the application the password and userid disappear / gone for good.
How do I save them to the keychain DB permanently please?
Thank you