Created
October 21, 2012 02:12
-
-
Save johndemic/3925465 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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