objective c - SSKeychain implementation load last login and pass -


i new objective-c. can not understand how do, when start program automatically inserts last name saved in nstextfiel , nssecuretextfield. save user name , password :

- (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");     } } 

and

[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");         }     } 

enter image description here

i checked in keychain stored data. how make implementation insert final login , password when loading program?

i guess can retrieve username , password in standard way.

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 

}


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -