我对目标-c是新的。我不明白如何做,当您启动程序时,自动插入已保存在NSTextFiel和NSSecureTextField中的姓氏。我保存用户名和密码:
- (void)saveLoginPass {
if ([checkBox state]==NSOnState) {
[SSKeychain setPassword:self.passwordField.stringValue forService:@"ERClient" account:self.loginField.stringValue];
NSLog(@"Login/pass save");
}
else if([checkBox state]==NSOffState){
NSLog(@"Don't save login/pass");
}
}和
[manager POST:URLString parameters:parameter success:^(AFHTTPRequestOperation *operation, id responseObject){
if ([operation.responseString rangeOfString:@"mainBody"].location == NSNotFound) {
alertFild.stringValue=@"Login or pass false";
NSLog(@"Login or pass false");
NSLog(@"responseObject: %@", responseObject);
NSLog(@"operation.responseString: %@",operation.responseString);
NSLog(@"operation.response: %@",operation.response);
} else {
browserWindowController = [[ERBrowserWindowController alloc] initWithWindowNibName:@"ERBrowserWindowController"];
[browserWindowController showWindow:self];
[browserWindowController addDefaultTabs];
[self saveLoginPass];
[loginWindow close];
NSLog(@"Аuthorized");
}
}

我签入Keychain成功地存储了数据。如何使实现在加载程序时插入最终登录和密码?
发布于 2015-03-20 23:18:12
我想你可以用标准的方式检索用户名和密码。
NSDictionary *credentials = [SSKeychain accountsForService:@"ERClient"].firstObject;
if (!credentials) {
return; // leave fields empty
}
NSString *accountName = credentialsDictionary[kSSKeychainAccountKey];
NSString *password = [SSKeychain passwordForService:@"ERClient" account:accountName];
// populate fields}
https://stackoverflow.com/questions/29177073
复制相似问题