简体   繁体   English

Facebook SDK 4.5 IOS 9

[英]Facebook SDK 4.5 IOS 9

I got an issue with the new FBSDK. 我遇到了新的FBSDK问题。 Whenever I try to call the login method logInWithReadPermissions, I get this error message: 每当我尝试调用登录方法logInWithReadPermissions时,我收到以下错误消息:

ERROR : "canOpenUrl : failed for url "fbauth2://" error: "(null)" 错误:“canOpenUrl:url失败”fbauth2://“错误:”(null)“

I have my config .plist file following the ios9 tuto ( https://developers.facebook.com/docs/ios/ios9 ) on dev.facebook. 我在dev.facebook上的ios9 tuto( https://developers.facebook.com/docs/ios/ios9 )后面有我的配置.plist文件。 So, I got the NSAppTransportSecurity dictionary and the LSApplicationQueriesSchemes array (with the string "fbauth2" on it) 所以,我得到了NSAppTransportSecurity字典和LSApplicationQueriesSchemes数组(上面有字符串“fbauth2”)

Would you know how to resolve this error? 你知道如何解决这个错误吗?

如果你仍然有问题,重置模拟器,这对我有用。

I have the same problem with Google+ Sign-in library, but i solved for Facebook updating at the last SDK version 4.6.0! 我在Google+登录库中遇到了同样的问题,但我在最新的SDK版本4.6.0上解决了Facebook更新问题!

Remember to change your plist key LSApplicationQueriesSchemes after the update like this: 请记住在更新后更改plist键LSApplicationQueriesSchemes ,如下所示:

<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]设置Bitcode:No From Build Settings

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

I had the same problem, but ran the app on my phone which has facebook installed and it worked. 我有同样的问题,但在我安装了facebook的手机上运行应用程序并且它运行正常。 It might be because it doesn't work on the simulator or facebook has to be installed. 这可能是因为它无法在模拟器上运行或必须安装facebook。 Anyone found anything else? 有人发现了什么?

if you already have items on LSApplicationQueriesSchemes. 如果你已经在LSApplicationQueriesSchemes上有项目。 let the Facebook items first. 让Facebook项目第一。

This solved my problem. 这解决了我的问题。

From Facebook FAQ at the bottom of the link: https://developers.facebook.com/docs/ios/ios9 来自Facebook常见问题解答链接底部: https//developers.facebook.com/docs/ios/ios9

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

Use like this in info.plist 在info.plist中使用这样的

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb123124123123</string>
            <string>fbauth2</string>
        </array>
    </dict>
</array>

After that you should remove your app from editor and launch again. 之后,您应该从编辑器中删除您的应用程序并再次启动。

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

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