Facebook SDK:app未注册为URL Scheme

问题描述 投票:69回答:9

我正在使用Facebook SDK找到here,我正在尝试提供的样本(在FacebookiOSSample文件夹中)。

如果我只是用我特定的AppId替换AppId,那么我就不能再分享了。 (我在AppDelegate文件和info.plist文件中替换了它)。我现在收到以下错误:

FBSDKLog:无效使用FBAppCall,fb ****未注册为URL方案。你在plist中设置了'FacebookUrlSchemeSuffix'吗?

否则这适用于样本的原始AppId,它指向名为IFaceTouch的东西。

我的应用程序设置有什么问题,如何注册我的AppId

ios facebook xamarin url-scheme
9个回答
193
投票

请遵循以下三个步骤:

  1. 使用字符串值创建名为FacebookAppID的密钥,并在其中添加应用程序ID。
  2. 使用字符串值创建名为FacebookDisplayName的键,并添加您在App Dashboard中配置的显示名称。
  3. 创建一个名为URL类型的数组键,其中包含一个名为URL Schemes的数组子项。使用前缀为fb的应用ID为单个项目。这用于确保应用程序将接收基于Web的OAuth流的回调URL。

完成的.plist看起来应该是这样的:

Source Link:


20
投票

在原始键和值方面,您应该有CFBundleURLTypes和CFBundleURLSchemes。希望有所帮助!


15
投票

信息下方还有另一部分 - 网址类型

检查URL Schemes字段下的值是否与上面属性列表中URL类型 - > URL Schemes中的值匹配。 (还匹配FacebookAppID)


9
投票

适用于iOS 9

如果您有错误:'LSApplicationQueriesSchemes'

基于Bear with me answer,您还必须添加以下行:

<key>LSApplicationQueriesSchemes</key>
<array>
   <string>fbauth2</string>
</array>

this

您最终应该在.plist文件末尾添加这些行:

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb2R3234544534554</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>2R3234544534554</string>
    <key>FacebookDisplayName</key>
    <string>stevejeff</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <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>
            <key>akamaihd.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
    </dict>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbauth2</string>
    </array>
    </dict>
    </plist>

*如果您使用的是SDK的v4.6.0或更高版本,则只需添加:*(感谢mohsinj

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

3
投票

转到此Link选择您的应用程序,并配置您的info.plist


2
投票

1-在Xcode中,右键单击项目的Info.plist文件,然后选择Open As - > Source Code。

2-在最终的</dict>元素之前,将以下XML片段插入到文件正文中。

  <key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fb{your-app-id}</string>
    </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>{your-app-id}</string>
<key>FacebookDisplayName</key>
<string>{your-app-name}</string>
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fb-messenger-share-api</string>
  <string>fbauth2</string>
  <string>fbshareextension</string>
</array>

3-将{your-app-id}和{your-app-name}替换为Facebook应用程序仪表板上的应用程序的应用程序ID和名称。


0
投票

今天我通过从FacebookDisplayName中删除空间来解决这个问题。

确保FacebookDisplayName中没有任何空格


0
投票

我不知道你的问题是否跟我的一样。但它花了我一些时间来找到它,我会把它放在这里,以便它可以帮助任何人..问题是,谷歌登录使用相同的info.plist属性名称,它覆盖了facebook的..所以我可以在X-Code中看到它并将它们组合在一起,现在一切正常! (URL类型属性)。


-2
投票

我也面临同样的问题。然后做了这个:

<dict> <key>CFBundleURLSchemes</key> <array> <string>fb154510174913175</string> <string>fbauth2</string> // add this line to remove the error </array> </dict>

问题现在已解决。

© www.soinside.com 2019 - 2024. All rights reserved.