Skip to content

Instantly share code, notes, and snippets.

@pratikshabhisikar
Forked from anonymous/gist:1141838
Created August 12, 2011 10:52
Show Gist options
  • Save pratikshabhisikar/1141852 to your computer and use it in GitHub Desktop.
Save pratikshabhisikar/1141852 to your computer and use it in GitHub Desktop.
@try {
if (versionOk == YES)
{
NSLog(@"Before Saving - Username: %@ and Password: %@", username.text, password.text);
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:username.text forKey:@"username"];
[userDefaults synchronize];
[userDefaults setObject:password.text forKey:@"password"];
[userDefaults synchronize];
NSString *usernameString1 = [[NSUserDefaults standardUserDefaults] objectForKey:@"username"];
NSString *passwordString1 = [[NSUserDefaults standardUserDefaults] objectForKey:@"password"];
NSLog(@"Before Saving - Username: %@ and Password: %@", usernameString1, passwordString1);
EDAMAuthenticationResult* authResult = [userStore authenticate:usernameString1 :passwordString1 :@"widevision-1247" : @"5065431cce534618"];
user = [authResult user];
authToken = [authResult authenticationToken];
NSLog(@"Authentication was successful for: %@", [user username]);
NSLog(@"Authentication token: %@", authToken);
EvernoteViewController *evernotebook = [[EvernoteViewController alloc] initWithNibName:@"EvernoteViewController" bundle:nil];
evernotebook.authToken = authToken;
evernotebook.noteStorebaseUri = noteStoreUriBase;
evernotebook.user =user;
[self.navigationController pushViewController:evernotebook animated:YES];
[evernotebook release];
}
}
@catch (NSException *ex) {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:[ex name]
message:[ex reason]
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment