Created
January 21, 2013 16:52
-
-
Save Dimillian/4587394 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-(void)onTwitterButton:(id)sender | |
{ | |
if ([TWTweetComposeViewController canSendTweet]) { | |
ACAccountStore *account = [[ACAccountStore alloc] init]; | |
ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; | |
[HUD show:YES]; | |
[account requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error){ | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
if (granted){ | |
MSTwitterSelectorViewController *TWSelector = | |
[[MSTwitterSelectorViewController alloc]initWithAccounts:[account accountsWithAccountType:accountType]]; | |
[TWSelector setDelegate:self]; | |
UINavigationController *twitterNC = [[UINavigationController alloc]initWithRootViewController:TWSelector]; | |
[self presentModalViewController:twitterNC animated:YES]; | |
} | |
else{ | |
[self displayTwitterAccessErrorMessage]; | |
[HUD hide:YES]; | |
} | |
});}]; | |
} | |
else{ | |
[self displayPleaseRegisterTwitterMessage]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment