繁体   English   中英

在XCode 7.0.1中将FB SDK(版本4.7.0)与iOS 9集成时出错:canOpenURL:URL失败:“ fbauth2:/”

[英]Error with integrating FB SDK (Version 4.7.0) with iOS 9 in XCode 7.0.1: canOpenURL: failed for URL: “fbauth2:/”

我按照此处的最新说明将FBSDK(下载的版本4.7.0)与最新的XCode集成在一起。 我很确定我已经在info.plist中配置了以下内容(我仅在4.7.0版中需要这些内容):

<key>LSApplicationQueriesSchemes</key>
<array>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
</array>

并复制了我在Facebook开发帐户中提供的所有内容。 但是,当我尝试使用Facebook登录按钮登录时,出现此错误:

canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"

当我看到此错误时,我的应用只是卡住了,即使我在Safari中单击了“确定”也似乎未通过身份验证。 我还看到了Facebook所解释的以下内容,但对我来说这没有意义,因为我的应用程序始终停留在此错误消息中。

In iOS 9, the app switches can prompt the user with a confirmation dialog. The SDK will try to minimize the frequency of this by choosing the best dialog available (such as SafariViewController), but this is by design in iOS 9.

我知道这听起来很愚蠢,但是我找到了解决方案,该解决方案与.plist文件中的设置无关。 我将以下两个函数放入我的App Delegate中,尽管上面出现了fbauth2警告,但一切正常

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
        // return FBAppCall.handleOpenURL(url, sourceApplication:sourceApplication, session:PFFacebookUtils.session())
        return FBSDKApplicationDelegate.sharedInstance().application(application,
            openURL: url,
            sourceApplication: sourceApplication,
        annotation: annotation)

    }



    //Make sure it isn't already declared in the app delegate (possible redefinition of func error)
    func applicationDidBecomeActive(application: UIApplication) {
        FBSDKAppEvents.activateApp()
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM