title: iOS - How to save password permanently?
body: <p>I have the following code:</p>
  
  <pre><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);
      }
  </code></pre>
  
  <p>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.</p>
  
  <p>How do I save them to the keychain DB permanently please?</p>
  
  <p>Thank you</p>