public
Created

  • Download Gist
gistfile1.m
Objective-C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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];
}
}];

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.