Question

I'm setting up twitter on iOS6 in an app. The problem I've stumbled upon is if: the user has multiple twitter accounts how do I choose which one to share to?

I've managed to get all the accounts in an array. But the question is how do I link this account:

 ACAccount *acct = [_accounts objectAtIndex:twitterAccountInt];

With this:

slComposerSheetController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
NSString *postText = [informationToBeShared objectForKey:@"postText"];
NSURL *postImageURL = [NSURL URLWithString:[informationToBeShared objectForKey:@"postImageURL"]];
NSURL *postURL = [NSURL URLWithString:[informationToBeShared objectForKey:@"postURL"]];

[slComposerSheetController setInitialText:[informationToBeShared objectForKey:@"postText"]];
[slComposerSheetController addImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:postImageURL]]];
[slComposerSheetController addURL:postURL];
[delegate presentViewController:slComposerSheetController animated:YES completion:nil];
Was it helpful?

Solution

If a user adds more twitter accounts in settings, the operating system adds an option over the SLComposeViewController where the user can choose which account he wants to tweet from.

It required no changes from me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top