Skip to content

Instantly share code, notes, and snippets.

@johndemic
Created October 21, 2012 02:12
Show Gist options
  • Save johndemic/3925465 to your computer and use it in GitHub Desktop.
Save johndemic/3925465 to your computer and use it in GitHub Desktop.
- (IBAction)storePassword:(id)sender
{
NSString *service = [NSString stringWithFormat:@"%@@%@", [username stringValue], [address stringValue]];
if ([SSKeychain passwordForService:service account:@"KH"] != nil) {
NSError *error = nil;
if ([SSKeychain deletePasswordForService:service account:@"KH" error:&error] == NO) {
NSLog(@"Could not delete existing password");
}
if (error != nil) {
NSLog(@"ERROR: %@", error);
}
NSString *retrievedPassword = [SSKeychain passwordForService:service account:@"KH"];
NSLog(@"RETRIEVED PASSWORD: %@", retrievedPassword);
}
[SSKeychain setPassword:[password stringValue] forService:service account:@"KH"] ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment