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

时间:2015-10-24 02:38:39

标签: ios xcode facebook swift sdk

我按照here的最新说明将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.

1 个答案:

答案 0 :(得分:0)

我知道这可能听起来很傻,但我找到了解决方案,这与我的.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()
    }