Created
November 21, 2012 21:32
-
-
Save ChrisRisner/4127917 to your computer and use it in GitHub Desktop.
iosLogout
This file contains hidden or 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
- (void)viewDidAppear:(BOOL)animated | |
{ | |
// If user is already logged in, no need to ask for auth | |
if (todoService.client.currentUser == nil) | |
{ | |
// We want the login view to be presented after the this run loop has completed | |
// Here we use a delay to ensure this. | |
[self performSelector:@selector(login) withObject:self afterDelay:0.1]; | |
} | |
} | |
-(void) login | |
{ | |
UINavigationController *controller = | |
[self.todoService.client | |
loginViewControllerWithProvider:@"twitter" | |
completion:^(MSUser *user, NSError *error) { | |
if (error) { | |
NSLog(@"Authentication Error: %@", error); | |
// Note that error.code == -1503 indicates | |
// that the user cancelled the dialog | |
} else { | |
// No error, so load the data | |
[self.todoService refreshDataOnSuccess:^{ | |
[self.tableView reloadData]; | |
}]; | |
} | |
[self dismissViewControllerAnimated:YES completion:nil]; | |
}]; | |
[self presentViewController:controller animated:YES completion:nil]; | |
} |
This file contains hidden or 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)tappedLogout:(id)sender; |
This file contains hidden or 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)tappedLogout:(id)sender { | |
[self.todoService.client logout]; | |
} |
This file contains hidden or 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)tappedLogout:(id)sender { | |
[self.todoService.client logout]; | |
for (NSHTTPCookie *value in [NSHTTPCookieStorage sharedHTTPCookieStorage].cookies) { | |
NSLog(@"%@", value); | |
} | |
} |
This file contains hidden or 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)tappedLogout:(id)sender { | |
[self.todoService.client logout]; | |
for (NSHTTPCookie *value in [NSHTTPCookieStorage sharedHTTPCookieStorage].cookies) { | |
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:value]; | |
} | |
} |
This file contains hidden or 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
[self.todoService refreshDataOnSuccess:^{ | |
[self.tableView reloadData]; | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment