我有SA_OAuthTwitterEngine
貌似在我的iOS應用程序中工作正常,但幾個月前,它停止工作(編輯:不工作在iOS 4或iOS 5,並沒有代碼在故障之前在應用程序中更改)。它正在驗證和存儲信譽良好,並將它們傳遞給我的數據庫服務就好了。當我嘗試發佈推文時,所有內容都會正常記錄,好像它正在經歷正確的過程。所有令牌和用戶名等正確傳遞。不過,我在Twitter上看不到任何帖子。我在帖子中使用了日期戳,並且已經在兩個不同的用戶帳戶上嘗試過這種方式,而未從任一帳戶中看到單個帖子。有趣的是,MGTwitterEngineDelegate
回調(requestSucceeded:
和requestFailed:
)沒有被調用。我在MGTwitterEngine的connection:didReceiveResponse:
,connection:didReceiveData:
和connection:didFailWithError:
中加入了斷點,以查看它是否僅僅是一個委託指派問題,但這些斷點從未到達,所以儘管我可以記錄連接標識符,但應用程序似乎沒有從Twitter獲得任何響應每次都從引擎的sendUpdate:方法返回。如果我可以讓代表接收連接的響應,也許我會看到一個錯誤。這就是我一整天都在b my我的頭腦。任何幫助,將不勝感激。iOS SA_OAuthTwitterEngine驗證,但沒有發佈,也沒有委託回調
代碼在這裏:
- (void)postTweetToTwitter
{
if (![[NSUserDefaults standardUserDefaults] objectForKey:TWITTER_USER]) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"ShowSettings" object:nil];
return; //Makes sure user data is stored in NSUserDefaults before continuing, if not, settings will prompt for authentication
}
NSString *formattedDateString = [NSDateFormatter localizedStringFromDate:[NSDate date] dateStyle:kCFDateFormatterShortStyle timeStyle:kCFDateFormatterNoStyle];
NSString *tweetMessage = [NSString stringWithFormat:@"%@: Tweet message goes here.", formattedDateString];
if(!_engine){
_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];
else {
NSString *twitterConnectionIdentifier = [_engine sendUpdate:[NSString stringWithString:tweetMessage]];
NSLog(@"Twitter Connection Identifier : %@", twitterConnectionIdentifier);
}
}
- (NSString *) cachedTwitterOAuthDataForUsername: (NSString *) username {
NSString *authData = [[NSUserDefaults standardUserDefaults] objectForKey:TWITTER_USER];
if (authData) {
return authData;
} else return [NSString stringWithString:@"No Twitter Data"];
//This just won't do anything, but we avoid this case in the first if statement above.
}