1

我想在 KeyChain 中存储一个字符串。我正在尝试使用 SSKeychain.h、SSKeychain.m、SSKeychainquery.h 和 SSKeychainquery.h

因为这些文件中有很多方法。所以我很困惑,想知道使用哪种方法以及如何使用。要存储的字符串是我的应用程序的密码。

4

1 回答 1

1

你可以试试这个变种:

// Store credentials in Keychain
[SSKeychain setPassword:@"thePassword"
                     forService:@"com.yourCompany.yourApp"
                        account:@"theUserName"];

// Retrieve credentials from Keychain 
NSString *password = [SSKeychain passwordForService:@"com.yourCompany.yourApp"
                                                account:@"theUserName"];
于 2016-06-27T12:15:43.777 回答