Created
February 12, 2013 23:03
-
-
Save 0xjmp/4774308 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)login:(UIButton *)sender | |
{ | |
NSString *userName = self.emailTextField.text; | |
NSString *password = self.passwordTextField.text; | |
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; | |
hud.labelText = @"Logging In..."; | |
TTLoginController *login = [[TTLoginController alloc] init]; | |
login.onLoginSuccessful = ^(TTUser *user) { | |
[TTUser loginWithUsername:userName password:password block:^(TTUser *user2, NSError *error) { | |
if (error) { | |
[UIAlertView showAlertViewWithTitle:NSLocalizedString(@"Server Error", @"Login Error Title") | |
message:NSLocalizedString(@"A Server error occurred. Please try again", @"Login Error Message") | |
cancelButtonTitle:NSLocalizedString(@"OK", @"Login Error OK Button") | |
otherButtonTitles:nil | |
handler:nil]; | |
} else { | |
// Temporary fix to avoid a retain cycle. | |
TTLoginController *loginAgain = [[TTLoginController alloc] init]; | |
loginAgain.onLoginSuccessful(user2); | |
} | |
[MBProgressHUD hideAllHUDsForView:self.view animated:YES]; | |
}]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment