在整个应用程序中分享Twitter细节

时间:2014-02-15 11:55:30

标签: ios twitter login share

我在我的IOS应用程序中实现了twitter共享。我使用MGTwitterEngine。如果我从同一个控制器实现登录和共享它正在工作,但是如果我在2个控制器中分离出登录和共享功能,它就无法工作。

  

SA_OAuthTwitterEngine * _engine;

_engine返回空白。

2 个答案:

答案 0 :(得分:1)

如果您的目标是iOS6或更新版本,您最好使用iOS社交API:

- (IBAction)postToTwitter:(id)sender {
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController
                                               composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"Great fun to learn iOS programming at appcoda.com!"];
        [self presentViewController:tweetSheet animated:YES completion:nil];
    }
}

有关详细信息,请参阅此处:http://www.appcoda.com/ios-programming-101-integrate-twitter-and-facebook-sharing-in-ios-6/

答案 1 :(得分:0)

Appcoda教程@xavier提到的很好,适用于ios6。我无法让它与iOS7一起工作。

相关问题