使用最新的 facebook sdk 3.1,我使用以下命令打开一个请求权限的会话:
[FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:allowLoginUI
completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
我的 sessionStateChanged 方法如下所示:
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState)state
error:(NSError *)error
{
switch (state) {
case FBSessionStateOpen:
// handle successful login
break;
case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed:
// handle failed login
break;
default:
break;
}
}
sessionStateChanged 中是否有任何方法可以区分这是否是用户第一次登录(即他们以前从未允许我们使用此特定应用程序)?