Facebook SDK 登录永远不会在 iOS 9 上回调我的应用程序 [英] Facebook SDK login never calls back my application on iOS 9

查看:33
本文介绍了Facebook SDK 登录永远不会在 iOS 9 上回调我的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照指南更新我的应用程序以使用 Facebook SDK 4.6使用 iOS 9 SDK 构建时正常工作.

I've followed this guide to update my application to use Facebook SDK 4.6 to work properly when built with the iOS 9 SDK.

当我现在点击登录按钮时,会显示一个 Safari 视图控制器(它不应该重定向到 Facebook 应用程序吗?),但是在接受许可后,Safari 视图控制器永远不会被解除.它加载一个新的空白页面,然后坐在那里什么也不做.如果我点击完成"按钮,则返回的 FBSDKLoginManagerLoginResultisCancelled 为 true.

When I tap the login button now, a Safari view controller gets presented (shouldn't it redirect to the Facebook app?), but after accepting permission the Safari view controller is never dismissed. It loads a new blank page and sits there doing nothing. If I tap the Done button, the returned FBSDKLoginManagerLoginResult's isCancelled is true.

SDK 选择 Safari 视图控制器而不是 Facebook 应用程序是否正常?为什么我在登录完成后没有收到回调?

Is it normal that the SDK is choosing the Safari view controller over the Facebook app? And why am I not getting callbacks after login is complete?

推荐答案

UIApplicationDelegateapplication:openURL:options: 被实现时,结果是在 iOS 9 上,application:openURL:sourceApplication:annotation: 不会被调用.

Turns out that on iOS 9 when UIApplicationDelegate's application:openURL:options: is implemented, application:openURL:sourceApplication:annotation: will not get called.

所以我必须做的是从 UIApplicationDelegate 调用 FBSDKApplicationDelegateapplication:openURL:sourceApplication:annotation:应用程序:openURL:选项:

So what I had to do is call FBSDKApplicationDelegate's application:openURL:sourceApplication:annotation: from UIApplicationDelegate's application:openURL:options:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
    return [[FBSDKApplicationDelegate sharedInstance] application:app
                                                      openURL:url
                                            sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                                   annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
}

这篇关于Facebook SDK 登录永远不会在 iOS 9 上回调我的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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