web-dev-qa-db-ja.com

iOS10でのFacebookログインの問題

Facebookを使用してアプリケーションにログインします。 iOS 10、iPhoneシミュレーター6sでFacebookを使用してログインしようとしています。

-canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

10814 : kLSApplicationNotFoundErr
-10814  No application in the Launch Services database matches the input criteria.

FacebookのSDKバージョンを使用しています4.13.1。 XCode 8より前は、同じコードが完全に機能していました。

ヘルプはありますか?前もって感謝します。

11
Mradul Kumar

エラーステータス10814は、基本的にcantOpenUrlが引数を使用してfacebookを呼び出すためにurlによって使用される場合に発生しますfbauth2:/。この スレッドで提案されているように印刷はこの関数内で行われるため、それでは何もできません

AppleはIOS 10の操作方法を変更しました。この問題を修正するには、次のURLにアクセスしてください。

ターゲット>機能> Keychain共有を有効にする

上記にリンクされている同じスレッドのスクリーンショットを次に示します enter image description here

この投稿に投稿されているように、フォーラムの 開発者 の問題

問題はFBSDLoginManagerにあり、完了ハンドラーは呼び出されません

したがって、debugingで、 authorbreakpoint in "FBSDKLoginManager.m" at "logInWithBehavior:(FBSDKLoginBehavior )loginBehavior "およびweakSelfがnilになり、" logInWithBehavior:serverConfiguration: serverConfigurationLoadError: "を呼び出せないことを確認します

   - (void)logInWithBehavior:(FBSDKLoginBehavior)loginBehavior  
    {  
      __weak __typeof__(self) weakSelf = self;  
      [FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:^(FBSDKServerConfiguration *serverConfiguration, NSError *loadError) {  
        [weakSelf logInWithBehavior:loginBehavior serverConfiguration:serverConfiguration serverConfigurationLoadError:loadError];  
      }];  
    }

解決策1:

FBSDKLoginManager変数を関数変数として使用するのではなく、プロパティとして変更します。FBSDKLoginManager変数存続する必要があります完了ハンドラー呼び出しまで確認してください

-Wimplicit-retain-self警告をオンにして、誤ってselfを参照した場合に警告を受け取ることができます。ブロック。 Githubの問題 に投稿されました

ソリューション2:

これらをplistに追加できます

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>akamaihd.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>facebook.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>fbcdn.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
    </dict>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
    </array>

また、AppDelegateを次のように変更します

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
     return SDKApplicationDelegate.shared.application(application,     didFinishLaunchingWithOptions: launchOptions)
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool
{
    return SDKApplicationDelegate.shared.application(app, open: url,    options: options)
}

author によって提案されているように、この後、Swift3、SDK、ios10で実行できます。 XCode8

また、 author が言及しているように、Google Analyticsが、設定によってビューコントローラーの上に独自のコントローラーを追加していたかどうかを確認します。

設定"FirebaseAppDelegateProxyEnabled"to"NO"in-Info.plist問題を解決しました。

完全な帰属は フォーラム およびフォーラムで言及されている著者に帰属します

12
Pritish Vaidya

機能->キーチェーン共有でキーチェーン共有が有効になっていることを確認してくださいキーチェーン共有を有効にする

1

Info.plist2に対応していることを確認してください。 https://developers.facebook.com/docs/ios/ios9 のFacebookアプリセクションのホワイトリスト

IOS Facebook SDK v.4.13の場合、次のものが含まれている必要があります

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

これらの要件は、iOS 9.xに導入されました。

0

AppDelegateのdidFinishLaunchingWithOptions関数にこの行を追加してみてください

FBSDKApplicationDelegate.sharedInstance()。application(application、didFinishLaunchingWithOptions:launchOptions)

0
valentina