我正在尝试将我的应用程序转换到新的 Facebook SDK 3.1(支持 iOS6 身份验证)。
我让它工作得很好,所以我决定从我在 FB 网站上的授权应用程序列表中删除该应用程序,以测试 iOS 是否会再次请求许可。
现在我第一次调用[FBRequest requestForMe]
导致此错误:
回复:
{
"error": {
"message": "Error validating access token: Session does not match current stored session. This may be because the user changed the password since the time the session was created or Facebook has changed the session for security reasons.",
"type":"OAuthException",
"code":190,
"error_subcode":460
}
}
一些细节:
我正在尝试按如下方式打开会话:
[FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
switch (state) {
case FBSessionStateOpen:
[self presentPostOptions];
break;
case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed:
[FBSession.activeSession closeAndClearTokenInformation];
break;
default:
break;
}
然后我在状态下被回调FBSessionStateOpen
(此时 iOS 还没有显示请求对话框,这是意料之中的吗)?Facebook 记录了这一点:
2012-09-26 13:43:43.768 MyApp[2177:907] FBSDKLog: FBSession INVALID transition from FBSessionStateCreated to FBSessionStateClosed
2012-09-26 13:43:43.769 MyApp[2177:907] FBSDKLog: FBSession transition from FBSessionStateCreated to FBSessionStateCreatedOpening
2012-09-26 13:43:43.837 MyApp[2177:907] FBSDKLog: FBSession transition from FBSessionStateCreatedOpening to FBSessionStateOpen
会话打开后,在 presentPostOptions 中我会这样做:
- (void)presentPostOptions
{
[[FBRequest requestForMe] startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
if (!error) {
self.usersName = user.name;
self.usersID = user.id;
[self getPages];
}
else
{
[self didFailWithError:error];
}
}];
}
在回调上述完成块之前,我的主状态处理程序块被调用一个FBSessionStateClosed
状态。与此同时,Facebook SDK 记录了上述错误。
我找不到任何方法来重置系统;我也不是很了解原因。
任何人都可以阐明一下吗?