ios - using Twitter SDK to send tweet failed, but I'dont know why -
i'm using twitter sdk loggin , tweet. authenticate it's ok, when use twtrcomposer simple text, sdk callback return 'twtrcomposerresultdone', simulator/device show 'the tweet "text" cannot sent because connection twitter failed. debugger show 'plugin com.apple.share.twitter.post invalidated' aparently correct.
is there bug or forgot thing.
my code:
twtrcomposer *composer = [[twtrcomposer alloc] init];
[composer settext:@"some text"];
[composer showwithcompletion:^(twtrcomposerresult result) { if (result == twtrcomposerresultcancelled) { nslog(@"tweet composition cancelled"); } else { nslog(@"sending tweet!"); } }];
tweet using sdk
1. crearte app on twitter.developer
2. add twitter frameworks twittercore.framework, twitterkit.framework, fabric.framework, twitterkitresources.bundle
3. write below code in tweet button
[[twitter sharedinstance] startwithconsumerkey:@"yourconsumerkey" consumersecret:@"yourconsumersecret"]; [fabric with:@[[twitter sharedinstance]]]; [[twitter sharedinstance] loginwithcompletion:^(twtrsession *session, nserror *error) { if (session) { nslog(@"logged in user id %@", session.userid); twtrcomposer *composer = [[twtrcomposer alloc] init]; [composer settext:@"enter tweet message"]; //[composer setimage:[uiimage imagenamed:@"fabric"]]; [composer showfromviewcontroller:self completion:^(twtrcomposerresult result) { if (result == twtrcomposerresultcancelled) { nslog(@"tweet composition cancelled"); } else { nslog(@"sending tweet!"); uialertview *warningalert = [[uialertview alloc] initwithtitle:@"" message:@"sent tweet!" delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [warningalert show]; } }]; } else { // log error } }];
Comments
Post a Comment