Skip to content

Instantly share code, notes, and snippets.

@MaximKeegan
Created April 26, 2013 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaximKeegan/5466130 to your computer and use it in GitHub Desktop.
Save MaximKeegan/5466130 to your computer and use it in GitHub Desktop.
- (IBAction)twitterButtonAction:(id)sender {
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) {
if (granted) {
NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
if ([accountsArray count] > 0) {
ACAccount *twitterAccount = [accountsArray lastObject];
DLog(@"%@ %@", twitterAccount.identifier, twitterAccount.username);
}
} else {
DLog(@"%@", [error localizedDescription]);
}
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment