Facebook SDK:openActiveSessionWithPermissions completionHandler未调用 [英] Facebook SDK: openActiveSessionWithPermissions completionHandler not called

查看:115
本文介绍了Facebook SDK:openActiveSessionWithPermissions completionHandler未调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Facebook的代码我实现了

Using the code from Facebook I have implemented

- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
    @"publish_actions", 
    nil];

    return [FBSession openActiveSessionWithPermissions:permissions
                                      allowLoginUI:allowLoginUI
                                 completionHandler:^(FBSession *session,
                                                     FBSessionState state,
                                                     NSError *error) {
   NSLog(@"error %@", error);                                     
    [self sessionStateChanged:session
                        state:state
                        error:error];
                                 }];
}

它返回否,我明白是因为它是第一次登录,而loginUI工作(它将用户发送到FB并请求他们授予权限),然后返回,但是doneHandler块永远不会运行。它只是返回到应用程序和nada。

It returns NO which I understand because it's a first time login, and the loginUI works (it sends the user to FB and asks them to give permissions) and then returns but completionHandler block is never ever run. It just returns to the app and nada.

推荐答案

稍晚,但是为了防止有人来检查...

Little late, but just in case someone comes checking...

从openActiveSession切换到实例方法openWithCompletionHandler为我做了一个伎俩。

Switching from openActiveSession to the instance method openWithCompletionHandler did the trick for me.

这篇关于Facebook SDK:openActiveSessionWithPermissions completionHandler未调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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