解析无效的会话令牌(代码:209,版本:1.7.1) [英] Parse invalid session token (Code: 209, Version: 1.7.1)

查看:30
本文介绍了解析无效的会话令牌(代码:209,版本:1.7.1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了我的 Parse 和 Facebook SDK(分别为 1.7.1 和 4.0) - 我可能会补充说这两个都非常痛苦!

I have just update both my Parse and Facebook SDK's (1.7.1 and 4.0 respectively) - both were an absolute pain to get working I might add!

但是,当我尝试使用 Facebook 登录时,我现在收到 209 个错误.

However I now getting 209 errors when I try to log in with Facebook.

这是我的代码示例:

- (void)loginWithFacebook:(HMSuccessBlock)completion{
NSArray *permissionsArray = @[@"user_about_me",@"user_location",@"user_friends",@"user_relationships"];

// Login PFUser using Facebook

[PFFacebookUtils logInInBackgroundWithReadPermissions:permissionsArray block:^(PFUser *user, NSError *error) {
    if (!user) {
        NSLog(@"Uh oh. The user cancelled the Facebook login.");
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Log In Error"
                                                        message:error.localizedDescription
                                                       delegate:nil
                                              cancelButtonTitle:nil
                                              otherButtonTitles:@"Dismiss", nil];
        [alert show];
        completion(NO, error);

    } else if (user.isNew) {
        NSLog(@"User signed up and logged in through Facebook!");
        if (completion) {
            completion(YES, nil);
        }
    } else {
        NSLog(@"User logged in through Facebook!");
           completion(YES, nil);
    }
}];
}

产生以下[错误]:无效的会话令牌(代码:209,版本:1.7.1)

Which yeilds the following [Error]: invalid session token (Code: 209, Version: 1.7.1)

我最初的想法是这个问题与我在应用程序委托中的代码有关 - 在旧版本的 facebooksdk 上,我会应用以下代码

My initial thinking is that the issue is something to do with my code in the app delegate - on older versions of the facebooksdk I would apply the following code

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [FBAppCall handleOpenURL:url
              sourceApplication:sourceApplication
                    withSession:[PFFacebookUtils session]];
}

但是我似乎找不到任何东西可以在更新版本中复制它,因此我的代码是

However I cant seem to find anything to replicate this in the updated version, hence my code being

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                      openURL:url
                                            sourceApplication:sourceApplication
                                                   annotation:annotation];
}

任何帮助将不胜感激.

推荐答案

发布的一些答案是临时修复 - 但是,如果用户注销并尝试重新登录,该问题稍后可能会再次出现 - 我认为这是由于对我来说也允许匿名用户 - 我可以清除它的唯一方法是在登录之前调用 [pfuser logout]

Some of the answers posted were temporary fixes - however the problem could reoccur later if a user logged out and tried to log back in again - I think this was due to me allowing anonymous users also - the only way I could clear it is to call [pfuser logout] prior to log in

这篇关于解析无效的会话令牌(代码:209,版本:1.7.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆