iOS KeychainItemWrapper not updating

前端 未结 2 1686
时光取名叫无心
时光取名叫无心 2020-12-14 12:33

I just found an interesting problem with my app. In the app I am saving the user\'s user name and password to the keychain.

keychainWrapper = [[KeychainItemW         


        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-14 13:02

    When you include

    keychainWrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"MyLoginPassword" accessGroup:nil];
    
    [keychainWrapper setObject:usernameField.text forKey:(id)kSecAttrAccount];
    [keychainWrapper setObject:passwordField.text forKey:(id)kSecValueData];
    

    you also had to include

    [keychainWrapper setObject:@"Myappstring" forKey: (id)kSecAttrService];
    

    Or I get a "SIGABRT" error. (Myappstring) is a string defining your application.

    Maybe I'm missing something, this should be done at least once.

提交回复
热议问题