我一直在使用經典的Ben Gottlieb Twitter開源項目來爲iPad創建twitter登錄。objective-c:iPad上的Twitter登錄錯誤:Whoa there
我的代碼來實例化引擎和顯示登錄控制器:
if (!_engine) {
_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
[_engine setConsumerKey:@"kConsumerKey"];
[_engine setConsumerSecret:@"kConsumerSecret"];
}
if (![_engine isAuthorized]){
UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];
if (controller){
if ([controller respondsToSelector:@selector(setModalPresentationStyle:)] == YES) {
controller.modalPresentationStyle = UIModalPresentationFormSheet;
}
[self presentModalViewController:controller animated:YES];
return;
}
}
另外,我設置URL的SA_OAuthTwitterEngine到https:
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"];
和我MGTwitterEngine.m TWITTER_DOMAIN已更改爲:
#define TWITTER_DOMAIN @"api.twitter.com/1"
在代碼中運行此代碼iPhone和iPad的模擬器就像一個魅力。 但是,每當我一個iPad設備上測試此代碼,我拋出這個錯誤:
Whoa there! The request token for this page is invalid. It may have already been used, or expired because it is too old. Please go back to the site or application that sent you here and try again; it was probably just a mistake
(截圖附後)。
如何得到標準的登錄屏幕出現任何建議,將不勝感激
傑夫凱利你能告訴我應該在哪裏添加這行代碼[myEngine requestRequestToken]; – Gypsa 2012-02-22 11:35:04
將其添加到創建引擎的位置。 – 2012-02-22 19:30:14
我試圖添加我創建引擎的位置,但它不起作用。 – Gypsa 2012-02-23 06:25:51