How to get user information from twitter in ios 6?

I am trying to integrate iOS 6 and twitter to send a tweet using slcomposeviewcontroller, but I cannot figure out how to get user information from a Twitter account.

Can someone help me?

+4
source share
1 answer

You were on the right track, but you were using the wrong structure. The SLComposeViewController class in the social structure is for sharing only. If you want information about the currently signed account, you need to use the Account Structure .

#import <Accounts/Accounts.h> - (void)getTwitterAccountInformation { ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; [accountStore requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error) { if(granted) { NSArray *accountsArray = [accountStore accountsWithAccountType:accountType]; if ([accountsArray count] > 0) { ACAccount *twitterAccount = [accountsArray objectAtIndex:0]; NSLog(@"%@",twitterAccount.username); NSLog(@"%@",twitterAccount.accountType); } } }]; } 
+11
source

All Articles