Skip to content

Instantly share code, notes, and snippets.

@volonbolon
Created October 10, 2012 16:45
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 volonbolon/3866796 to your computer and use it in GitHub Desktop.
Save volonbolon/3866796 to your computer and use it in GitHub Desktop.
ACAccountStore *as = [[ACAccountStore alloc] init];
[self setAccountStore:as];
ACAccountType *twitterAccountType = [[self accountStore] accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[[self accountStore] requestAccessToAccountsWithType:twitterAccountType
withCompletionHandler:^(BOOL granted, NSError *error) {
if ( granted == NO ) {
[self showNoTwitterAccountAlert];
return;
}
NSArray *twitterAccounts = [[self accountStore] accountsWithAccountType:twitterAccountType];
if ( [twitterAccounts count] > 0 ) {
[self setTwitterAccount:[twitterAccounts lastObject]];
[self retrieveIDs];
} else {
[self showNoTwitterAccountAlert];
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment