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

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

问题描述

我刚刚更新了我的Parse和Facebook SDK(分别为1.7.1和4.0) - 两者都是绝对痛苦的工作,我可能会添加!



然而我现在得到209错误,当我尝试用Facebook登录这里是我的代码的例子

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

//使用Facebook登录PFUser

[PFFacebookUtils logInInBackgroundWithReadPermissions:permissionsArray block:^(PFUser * user,NSError * error){
if(!user){
NSLog(@呃哦,用户取消了Facebook登录。);
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@登录错误
消息:error.localizedDescription
委托:nil
cancelButtonTitle:nil
otherButtonTitles: @Dismiss,nil];
[alert show];
完成(NO,错误);

} else if(user.isNew){
NSLog(@用户注册并通过Facebook登录!);
if(completion){
completion(YES,nil);
}
} else {
NSLog(@用户通过Facebook登录!);
完成(YES,nil);
}
}];

}



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



我的初步想法是,这个问题与我的应用程序代理中的代码有关 - 在旧版本的facebooksdk我将应用以下代码

   - (BOOL)应用程序:(UIApplication *)应用程序openURL: (NSURL *)url sourceApplication:(NSString *)sourceApplication注释:(id)注释{
return [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
withSession:[PFFacebookUtils session]];

}



找到任何东西在更新版本中复制,因此我的代码是

   - (BOOL)应用程序:(UIApplication *)应用程序openURL (NSURL *)url sourceApplication:(NSString *)sourceApplication注释:(id)注释{
return [[FBSDKApplicationDelegate sharedInstance]应用程序:应用程序
openURL:url
sourceApplication:sourceApplication
注释:注释];

}



任何帮助都会很大赞赏

解决方案

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


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!

However I now getting 209 errors when I try to log in with facebook here's an example of my code

- (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);
    }
}];

}

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

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];

}

Any help would be greatly appreciated

解决方案

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天全站免登陆