简体   繁体   English

iOS 9 Facebook登录模拟器-canOpenURL:URL失败:“ fbauth2:///”-错误:“(空)”

[英]iOS 9 Facebook login simulator -canOpenURL: failed for URL: “fbauth2:///” - error: “(null)”

I've updated to Xcode 7 and the latest iOS SDK. 我已经更新到Xcode 7和最新的iOS SDK。 I've added the appropriate entries in my app's plist: 我在应用程序的plist中添加了相应的条目:

在此处输入图片说明

My app's Facebook login works fine on device. 我的应用程序的Facebook登录名在设备上正常运行。 However, on iOS 9 simulator, I'm getting: 但是,在iOS 9模拟器上,我得到了:

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

And login is not working. 并且登录不起作用。 I've seen facebook login issue - canOpenURL: failed for URL: "fbauth2:///" - error: "(null)" but I have FBSDKCoreKit framework. 我已经看到Facebook登录问题-canOpenURL:URL失败:“ fbauth2:///”-错误:“(null)”,但是我有FBSDKCoreKit框架。 I've also seen Facebook SDK 4.5 IOS 9 but it's answer doesn't solve my problem. 我也看过Facebook SDK 4.5 IOS 9,但是答案并不能解决我的问题。

Why am I getting this error on simulator and not on device even though I've done the checklist at https://developers.facebook.com/docs/ios/ios9 ? 即使我已经完成https://developers.facebook.com/docs/ios/ios9上的清单,为什么在模拟器上而不是在设备上却出现此错误?

Why do I see console messages like 'canOpenURL: failed for URL: "fb...://' or ? 为什么我看到控制台消息,例如“ canOpenURL:URL失败:“ fb ...://”或?

This is an Xcode warning indicating the the canOpenURL: call returned false. 这是Xcode警告,指示canOpenURL:调用返回false。 As long as you have configured the LSApplicationQueriesSchemes entry in your plist as described above, you can ignore this warning . 如上所述,只要您在plist中配置了LSApplicationQueriesSchemes条目, 就可以忽略此警告

This is not a problem. 这不是问题。 The FB SDK is trying to open the native facebook app which has the fbauth2:// url type. FB SDK尝试打开具有fbauth2:// url类型的本地Facebook应用。 In Simulator its not available, so its just putting a log that it could not open the native Facebook app. 在Simulator中,它不可用,因此它只记录了无法打开本机Facebook应用程序的日志。 You can configure the Facebook acct in Simulator and then tell the FB Login button to use the native Facebook account instead of opening the web view. 您可以在模拟器中配置Facebook帐户,然后告诉FB登录按钮使用本地Facebook帐户,而不是打开Web视图。 But Facebook contends that millions of people use Facebook in browser and so in iOS 9 they have used the new SFSafariViewController as the default behaviour for facebook logins even on devices. 但是Facebook认为,数百万的人在浏览器中使用Facebook,因此在iOS 9中,他们甚至在设备上使用新的SFSafariViewController作为Facebook登录的默认行为。 You can try to use the native Facebook and see if it works. 您可以尝试使用本机Facebook,看看它是否有效。

Check this link for the discussion. 查看此链接进行讨论。

https://www.facebook.com/login.php?next=https%3A%2F%2Fdevelopers.facebook.com%2Fbugs%2F786729821439894%2F%3Fsearch_id https://www.facebook.com/login.php?next=https%3A%2F%2Fdevelopers.facebook.com%2Fbugs%2F786​​729821439894%2F%3Fsearch_id

After you have updated your App's .plist file with the LSApplicationQueriesSchemes array, which you seem to have already done: LSApplicationQueriesSchemes数组更新应用程序的.plist文件后,您似乎已经完成了:

Next , verify that your Facebook SDK is version 4.6.0 . 接下来 ,验证您的Facebook SDK是版本4.6.0 Follow the Facebook directions if it's not. 如果不是,请按照Facebook的指示进行操作

Lastly , which is probably where the problem arises, is to Reset your Simulator's content and settings 最后 ,可能是出现问题的地方是重置模拟器的内容和设置

To Reset your Simulator: 重置模拟器:

  1. Choose Simulator 选择模拟器
  2. Select Reset Content & Settings 选择重置内容和设置
  3. and the Reset option 重置选项

Apple's Simulator, even the IDE, will have bugs and closing and reopening, along with reseting the simulator, are always something to consider early on in your search for a solution. Apple的Simulator,甚至是IDE,都将出现错误,并且关闭和重新打开以及重置Simulator始终是您在寻找解决方案时应首先考虑的问题。

Hope this helps! 希望这可以帮助!

我将Facebook SDK从4.7版本降级到4.5.1,并且在Simulator和iphone设备(未安装Facebook应用)上均能正常工作。

According to Facebook: 根据Facebook:

iOS SDK supports SafariViewController which lets us switch show web-rendered dialogs instead of doing an app-switch. iOS SDK支持SafariViewController,它使我们可以切换显示Web呈现的对话框,而无需进行应用程序切换。 This beta SDK will automatically determine the best app switch experience for people based on their device. 这个Beta版SDK将根据用户的设备自动确定最佳的应用切换体验。 For example, defaulting the person's experience through SafariViewController instead of Safari for Facebook Login.... 例如,通过SafariViewController而不是Safari通过Facebook登录来默认用户的体验。

Facebook reference link: https://developers.facebook.com/bugs/786729821439894/?search_id Facebook参考链接: https : //developers.facebook.com/bugs/786729821439894/?search_id

Stack ref link: https://stackoverflow.com/a/32593070/2905967 堆栈引用链接: https : //stackoverflow.com/a/32593070/2905967

By following these steps, you may be able to avoid this error: 通过执行以下步骤,您可以避免此错误:

1) go to -> Supporting File 1)转到->支持文件

2) info.plist 2)info.plist

3) Right click on info.plist -> Open As -> Select Source Code 3)右键单击info.plist->打开为->选择源代码

* Add code below inside <dict>...</dict> * *在<dict>...</dict>内部添加代码

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

1] Authentication in Developer.facebook and generate Facebook Id like :=>460481580805052 1]在Developer.facebook中进行身份验证并生成Facebook ID,例如:=> 460481580805052

2] Set Bitcode : No From Build Settings 2]设置位码:从构建设置中否

3] Set up Plist File 3]设定Plist档案

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb460481580805052</string>
        </array>
    </dict>
</array>

<key>FacebookAppID</key>
<string>460481580805052</string>

<key>LSRequiresIPhoneOS</key>
<true/>
<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>fbapi20130214</string>
    <string>fbapi20130410</string>
    <string>fbapi20130702</string>
    <string>fbapi20131010</string>
    <string>fbapi20131219</string>
    <string>fbapi20140410</string>
    <string>fbapi20140116</string>
    <string>fbapi20150313</string>
    <string>fbapi20150629</string>
    <string>fbauth</string>
    <string>fbauth2 </string>
    <string>fb-messenger-api20140430</string>
    <string>fb-messenger-platform-20150128</string>
    <string>fb-messenger-platform-20150218</string>
    <string>fb-messenger-platform-20150305</string>
</array>

4] Download 4 Sdk Framework like 4]下载4个SDK框架,例如

=>Bolts.framework
=>FBSDKCoreKit.framework
=>FBSDKLoginKit.framework
=>FBSDKShareKit.framework

请使用LSApplicationQueriesSchemes或将pid添加到您的应用ID中。

For iOS 9 or above, add this method in your AppDelegate file: 对于iOS 9或更高版本,在您的AppDelegate文件中添加以下方法:

https://stackoverflow.com/a/43515243/535013 https://stackoverflow.com/a/43515243/535013

暂无
暂无

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

相关问题 facebook登录问题 - canOpenURL:网址失败:“fbauth2:///” - 错误:“(null)” - facebook login issue - canOpenURL: failed for URL: “fbauth2:///” - error: “(null)” Facebook 登录套件,带有 iOS 13“canOpenURL:URL 失败:“fbauth2:///” - Facebook Login kit with iOS 13 "canOpenURL: failed for URL: “fbauth2:///”" -canOpenURL:URL失败:“ fbauth2:/”-iOS 9错误:“(空)”(快速) - -canOpenURL: failed for URL: “fbauth2:/” - error: “(null)” for ios 9 (swift) -canOpenURL:URL失败:“fbauth2:/” - 错误:“(null)” - -canOpenURL: failed for URL: “fbauth2:/” - error: “(null)” Facebook登录无法加载并显示错误-canOpenURL:URL失败:“ fbauth2:/”-错误: - Facebook Login doesn't load and prints error -canOpenURL: failed for URL: “fbauth2:/” - error: -canOpenURL:URL失败:“fbauth2:/” - 错误:“此应用程序不允许查询方案fbauth2”(OSStatus错误-10814。) - -canOpenURL: failed for URL: “fbauth2:/” - error: “This app is not allowed to query for scheme fbauth2” (OSStatus error -10814.) -canOpenURL:URL失败:“fbauth2:/”(OSStatus错误-10814。)“ - -canOpenURL: failed for URL: “fbauth2:/” (OSStatus error -10814.)" 在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:/” 带有firebase canOpenURL的Swift Facebook Auth:URL失败:“ fbauth2:/”-错误:“该操作无法完成。 (OSStatus错误-10814。)” - Swift Facebook Auth with firebase canOpenURL: failed for URL: “fbauth2:/” - error: “The operation couldn’t be completed. (OSStatus error -10814.)” iOS:-canOpenURL:URL失败:“ fbauth2:/”-错误:“操作无法完成。 (OSStatus错误-10814。)”在模拟器和设备上 - iOS: -canOpenURL: failed for URL: “fbauth2:/” - error: “The operation couldn’t be completed. (OSStatus error -10814.)” on Simulators & Devices
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM