2012-01-02 139 views
1

我使用Twitter誓言Twitter的共享,突然間,當我點擊Tweet按鈕時,相同的代碼崩潰。應用程序崩潰時,Tweet按鈕點擊SIGKILL錯誤

應用程序在Twitter宣誓發送更新請求時崩潰。

這裏是共享選項

-(IBAction)ShareWithTwitter:(id)sender 
{ 
    NSLog(@"Tweet !!!"); 

if(!_engine) 
{ 
    _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self]; 
    _engine.consumerKey =kOAuthConsumerKey; 

    _engine.consumerSecret = kOAuthConsumerSecret; 
} 
else 
{ 

    _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self]; 
    _engine.consumerKey =kOAuthConsumerKey; 

    _engine.consumerSecret = kOAuthConsumerSecret; 


} 

UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self]; 

if (controller) 
{ 
    [self presentModalViewController: controller animated: YES]; 
} 


} 

的代碼和這個代碼是分享Tweet! (哪裏的應用程序崩潰)。

-(IBAction)updateTwitter:(id)sender 
{ 
activityIndicatorView.hidden=NO; 
activityIndicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; 
[activityIndicatorView startAnimating]; 

[tweetTextField resignFirstResponder]; 

NSString *strToPostOnTwitter = @"Hello Happy New Year to All !!!"; 

NSLog(@"String to Post is : %@",strToPostOnTwitter); 

//Twitter Integration Code Goes Here 
[_engine sendUpdate:strToPostOnTwitter]; 

//btnTwitter.hidden = YES; 

} 
+0

嘿!你沒有得到我的通知。? – mAc 2012-01-04 06:40:26

+0

米沒有得到! – NSException 2012-01-04 08:53:57

+0

爲我工作..... http://stackoverflow.com/questions/8576877/mgtwitterengine-crash-in-ios5 – 2012-01-24 12:48:53

回答

0

如果您在iOS 5上測試它很多次,它甚至不會正確生成令牌。您使用的Twitter引擎僅適用於iOS4。

現在來到您的代碼,因爲沒有生成令牌,並且沒有它,您將嘗試發佈消息並因此崩潰。過去一個月我做了很多研究,並決定採用這種方式: 如果您正在運行應用程序的iOS 5設備使用twitter框架。否則使用MGTwitterEngine。

查找以下網址的
http://iosdevelopertips.com/core-services/ios-5-twitter-framework-part-1.html
http://iosdevelopertips.com/core-services/ios-5-twitter-framework-part-2.html
http://iosdevelopertips.com/core-services/ios-5-twitter-framework-%E2%80%93-part-3.html

+0

有沒有教程或示例代碼的Twitter框架? – NSException 2012-01-02 09:31:55

+0

感謝您的鏈接,但第三個鏈接沒有任何教程,讓我試試其餘的兩個。再次感謝。 – NSException 2012-01-02 09:59:13

+0

前兩個鏈接就足夠了。第三個只是供參考。 – Satyam 2012-01-02 10:21:40

相關問題