iOS 11:Facebook登录无法正常工作

时间:2018-03-12 13:17:30

标签: swift facebook ios11

我想使用自定义网址方案以及Facebook登录,但它不起作用:

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool

但Facebook期望返回值为

FBSDKApplicationDelegate.sharedInstance().application(_:application, open: url, sourceApplication: sourceApplication, annotation:annotation)

因此,在使用新的openUrl方法时,我无法填写必要的参数。有谁知道如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您应该使用FBSDKApplicationDelegate.application(_: open: options:)代替。

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    if FBSDKApplicationDelegate.sharedInstance().application(app, open: url, options: options) {
        return FBSDKApplicationDelegate.sharedInstance().application(app, open: url, options: options)
    } else {
        //fallback if FBSDKApplicationDelegate cannot open URL
    }
}