我需要在我的iOS應用程序中實現twitter登錄,我已經安裝了與fabric SDK的twitter框架。現在,我第一次遇到問題,而登錄英寸我能夠接收令牌的詳細信息Twitter SDK SDK與織物
Twitter的詳細信息:@TestUserApp登錄! (796637020760186880)
驗證令牌:796637020760186880,ieeZM2Mbn3FLutLOcJ1sk7bp83ZSlzU
身份驗證令牌祕密:1G0O5YdF89V0VtoNmdY8W3ui2pkPNvKgtNPbqrleOiIoB
錯誤:錯誤域= TwitterAPIErrorDomain碼= 99「請求失敗: 禁止(403) 「UserInfo = {NSLocalizedFailureReason = Twitter API錯誤 :無法驗證您的憑據(代碼99), TWTRNetworkingStatusCode = 40 3, NSErrorFailingURLKey = https://api.twitter.com/oauth2/token, NSLocalizedDescription =請求失敗:禁止(403)}
全碼:
TWTRLogInButton *logInButton = [TWTRLogInButton buttonWithLogInCompletion:^(TWTRSession *session, NSError *error) {
if (session) {
NSString *authToken = session.authToken;
NSString *authTokenSecret = session.authTokenSecret;
NSString* userId = session.userID;
NSString *message = [NSString stringWithFormat:@"@%@ logged in! (%@) -Auth token:%@ -Auth Token secret:%@",
[session userName], [session userID],authToken,authTokenSecret];
// Objective-C
TWTRAPIClient *client = [[TWTRAPIClient alloc] init];
[client loadUserWithID:userId completion:^(TWTRUser *user, NSError *error) {
if (error == nil) {
NSLog(@"Name:%@ -- ScreenName:%@ -- ProfileImageUrl:%@",user.name,user.screenName,user.profileImageURL);
}
else {
NSLog(@"Error:%@",error.description);
}
}];
} else {
NSLog(@"Login error: %@", [error localizedDescription]);
}
}];