iOS: How to store username/password within an app?

前端 未结 14 1162
独厮守ぢ
独厮守ぢ 2020-11-22 06:18

I have a login-screen in my iOS app. The username and password will be saved in the NSUserDefaults and be loaded into the login-screen again when you enter the

14条回答
  •  名媛妹妹
    2020-11-22 06:24

    try this one:

     KeychainItemWrapper *keychainItem = [[KeychainItemWrapper alloc] initWithIdentifier:@"YourAppLogin" accessGroup:nil];
    [keychainItem setObject:@"password you are saving" forKey:kSecValueData]; 
    [keychainItem setObject:@"username you are saving" forKey:kSecAttrAccount];
    

    may it will help.

提交回复
热议问题