Created
September 30, 2011 18:19
-
-
Save greenisus/1254563 to your computer and use it in GitHub Desktop.
saving an account
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)loginButtonPressed:(id)sender { | |
// this is obviously temporary until we decide on UI for this :) | |
self.navigationItem.title = @"Authenticating..."; | |
RSAccount *account = [RSAccount blank]; | |
account.provider = self.provider; | |
account.username = self.usernameTextField.text; | |
account.api_key = self.apiKeyTextField.text; | |
[account authenticate:^(CKResult *result) { | |
if ([result isSuccess]) { | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[account save]; | |
[self dismissModalViewControllerAnimated:YES]; | |
}); | |
} else { | |
[self alert:@"There was a problem logging in. Please check your username and API key."]; | |
} | |
} errorBlock:^(CKResult *result) { | |
[self alert:@"login failed"]; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment