我正在使用Facebook创建新用户或登录Parse.
>用户使用Facebook登录登录应用程序
>用户提示接受权限.
>用户接受应用程序请求的所有权限.
4.用户删除了应用程序的权限(从Facebook删除应用程序)
我想知道我们检查用户是否已更改Facebook中应用程序的授权状态的方式是什么.
我该如何检查?我们怎么知道它不再连接?
FBSDKAccessToken.currentAccessToken();不能完成这项工作,因为它只能检查设备中是否存在令牌.
I.E.:用户进入Facebook应用程序设置并从列表中删除应用程序.
p.s.:请帮助推荐这个问题,因为很难找到解决方案.谢谢!!
谢谢
解决方法
Handling an Invalidated Session
We cannot know if the cached Facebook session is valid until we
attempt to make a request to the API. A session can become invalidated
if a user changes their password or revokes the application’s
privileges. When this happens,the user needs to be logged out. We can
identify an invalid session error within a FBSDKGraphRequest
completion handler and automatically log the user out.
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraPHPath:@"me" parameters:nil]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,id result,NSError *error) { if (!error) { // handle successful response } else if ([[error userInfo][@"error"][@"type"] isEqualToString: @"OAuthException"]) { // Since the request Failed,we can check if it was due to an invalid session NSLog(@"The facebook session was invalidated"); [PFFacebookUtils unlinkUserInBackground:[PFUser currentUser]]; } else { NSLog(@"Some other error: %@",error); } }];
资料来源:@L_502_0@