我正在使用Facebook SDK
找到here,我正在尝试提供的样本(在FacebookiOSSample
文件夹中)。
如果我只是用我特定的AppId
替换AppId
,那么我就不能再分享了。 (我在AppDelegate
文件和info.plist
文件中替换了它)。我现在收到以下错误:
FBSDKLog:无效使用FBAppCall,fb ****未注册为URL方案。你在plist中设置了'FacebookUrlSchemeSuffix'吗?
否则这适用于样本的原始AppId
,它指向名为IFaceTouch
的东西。
我的应用程序设置有什么问题,如何注册我的AppId
?
请遵循以下三个步骤:
完成的.plist看起来应该是这样的:
在原始键和值方面,您应该有CFBundleURLTypes和CFBundleURLSchemes。希望有所帮助!
信息下方还有另一部分 - 网址类型
检查URL Schemes字段下的值是否与上面属性列表中URL类型 - > URL Schemes中的值匹配。 (还匹配FacebookAppID)
适用于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>
转到此Link选择您的应用程序,并配置您的info.plist
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和名称。
今天我通过从FacebookDisplayName中删除空间来解决这个问题。
确保FacebookDisplayName中没有任何空格
我不知道你的问题是否跟我的一样。但它花了我一些时间来找到它,我会把它放在这里,以便它可以帮助任何人..问题是,谷歌登录使用相同的info.plist属性名称,它覆盖了facebook的..所以我可以在X-Code中看到它并将它们组合在一起,现在一切正常! (URL类型属性)。
我也面临同样的问题。然后做了这个:
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb154510174913175</string>
<string>fbauth2</string> // add this line to remove the error
</array>
</dict>
问题现在已解决。