簡體   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