문제

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];
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top