2012-04-20 54 views

回答

1

嘗試通過更換這個功能在"SA_OAuthTwitterEngine.m"

- (SA_OAuthTwitterEngine *) initOAuthWithDelegate: (NSObject *) delegate { 
    if (self = (id) [super initWithDelegate: delegate]) { 
     self.requestTokenURL = [NSURL URLWithString: @"http://twitter.com/oauth/request_token"]; 
     self.accessTokenURL = [NSURL URLWithString: @"http://twitter.com/oauth/access_token"]; 
     self.authorizeURL = [NSURL URLWithString: @"http://twitter.com/oauth/authorize"]; 
    } 
    return self; 
} 

替代該代碼使用這一個

0的

這一個解決我的問題........

0

Twitter integration for iOS 5 Tutorial

一個在iOS 5中的激動人心的新功能是Twitter的整合。照片,YouTube,Safari和地圖都完全集成在一起。根據Twitter首席執行官的說法,大多數iOS 5用戶都是Twitter用戶(根據Twitter首席執行官的說法,Twitter每日註冊人數增加了三倍),讓用戶發佈關於您的應用的推文信息可以幫助他們應對更多人。在這個iDevBlogADay文章中,我想編寫一個將你的應用程序與Twitter集成的教程。

2

您使用的IOS 5 API以及工作"SA_OAuthTwitterEngine.m"

只有輕微的變化"SA_OAuthTwitterEngine.m"

- (SA_OAuthTwitterEngine *) initOAuthWithDelegate: (NSObject *) delegate 
{ 
    if (self = (id) [super initWithDelegate: delegate]) { 
     self.requestTokenURL = [NSURL URLWithString: @"https://twitter.com/oauth/request_token"]; 
     self.accessTokenURL = [NSURL URLWithString: @"https://twitter.com/oauth/access_token"]; 
     self.authorizeURL = [NSURL URLWithString: @"https://twitter.com/oauth/authorize"]; 
    } 
    return self; 
} 
0

替換該功能對於Twitter的整合在iOS 5中它很容易,因爲新框架添加到ios 5起,只需按照下列步驟操作: 1. add twitter.framework 2. follow from twitter official site

0

在ios-5中有一個非常簡單的方法用於整合twitter,只需添加Twitter框架並使用此代碼即可。鏈接如下。

http://bit.ly/FLTwitter

0

您也可以使用此代碼與iOS5的Twiiter的內在框架..... 剛剛從你的編譯庫 添加Twitter.framework,然後只需要導入波紋管頭文件在你viewcontroller.h文件

#import <Twitter/TWTweetComposeViewController.h> 

afetr,當你想分享你在Twitter上的消息只是用波紋管代碼 在viewcontroller.m文件再次只需要導入

#import <Twitter/TWTweetComposeViewController.h> 

.....

- (IBAction)shareOnTwitter:(id)sender { 

    TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init]; 

    [twitter setInitialText:@"It's really that simple!"]; 
    [twitter addImage:[UIImage imageNamed:@"yourimage.jpg"]];//if required 
    [twitter addURL:[NSURL URLWithString:@"your url link"]];//if required 

    [self presentViewController:twitter animated:YES completion:nil]; 

    twitter.completionHandler = ^(TWTweetComposeViewControllerResult res) { 

     if(res == TWTweetComposeViewControllerResultDone) 
     { 

      UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Succes!" message:@"Your Tweet was posted succesfully" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 

      [alertView show]; 


     }else if(res == TWTweetComposeViewControllerResultCancelled) 
     { 

      UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Canceled" message:@"Your Tweet was not posted" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 

      [alertView show]; 

     } 

     [self dismissModalViewControllerAnimated:YES]; 

    }; 

} 

願這幫助你 這個代碼可以在模擬器B時無法正常工作一段時間所以在設備測試.....