我想我的应用程序迁移到新的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已经登录了上述错误。
我找不到任何方式重置系统; 我也不真正了解的原因。
任何人都可以请一些启发?