2014-02-15 74 views
0

我在我的IOS應用程序中實現了twitter分享。我可以使用MGTwitterEngine。如果我從同一個控制器實現登錄和共享,那麼它正在工作,但是如果我將兩個控制器中的登錄和共享功能分開,則它不起作用。在整個應用程序中分享微博細節

SA_OAuthTwitterEngine * _engine;

_engine return blank。

回答

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/

+0

我不想介紹評論控制器。我想發送沒有presentViewController的帖子。這可能嗎? –

+0

使用社交框架也許是可能的,但並不那麼容易。您可能必須低得多,所以使用MGTwitterEngine並複製一些示例可能會更輕鬆。如果我沒有錯,使用MGTwitterEngine的缺點是沒有與設備上的用戶配置文件集成。 –

0

提到的Appcoda教程@xavier好,使用ios6可以正常工作。儘管如此,我還是無法使用它來與iOS7一起工作。