Permalink
Browse files

Update SampleApp view controller for async APIs.

  • Loading branch information...
1 parent 2d2e588 commit 5280fd9a04112277b0870f66ade5b04ec8476dde @mcglincy mcglincy committed Apr 23, 2012
Showing with 5 additions and 29 deletions.
  1. +5 −29 SampleApp/ViewController.m
View
@@ -61,40 +61,16 @@ - (IBAction)authenticate:(id)sender
- (void)showUserInfo
{
- EvernoteSession *session = [EvernoteSession sharedSession];
- // Use a try/catch block around any Evernote/Thrift operations,
- // which might throw a TException, EDAMUserException, or EDAMSystemException.
- @try {
- EDAMUser *user = [session.userStore getUser:session.authenticationToken];
+ EvernoteUserStore *userStore = [EvernoteUserStore userStore];
+ [userStore getUserWithSuccess:^(EDAMUser *user) {
self.userLabel.text = user.username;
}
- @catch (NSException *exception) {
- NSLog(@"%@", exception);
- }
- @finally {
- }
+ failure:^(NSError *error) {
+ NSLog(@"error %@", error);
+ }];
}
- (IBAction)listNotes:(id)sender {
- /*
- EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];
- NSArray *notebooks = [noteStore listNotebooks];
- if (noteStore.error) {
- NSLog(@"error %@", noteStore.error);
- } else {
- NSLog(@"notebooks: %@", notebooks);
- }
- */
-
- /*
- EvernoteUserStore *userStore = [EvernoteUserStore userStore];
- EDAMUser *user = [userStore getUser];
- if (userStore.error) {
- NSLog(@"error %@", userStore.error);
- } else {
- NSLog(@"user: %@", user);
- }
- */
EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];
[noteStore listNotebooksWithSuccess:^(NSArray *notebooks) {
NSLog(@"notebooks: %@", notebooks);

0 comments on commit 5280fd9

Please sign in to comment.