简体   繁体   English

Swift Facebook 登录 AppID 未注册为 URL 方案

[英]Swift Facebook Login AppID Not Registered as a URL Scheme

I'm getting the following error when trying to login with Facebook尝试使用 Facebook 登录时出现以下错误

Terminating app due to uncaught exception 'InvalidOperationException', reason: 'fb---AppID--- is not registered as a URL scheme.由于未捕获的异常“InvalidOperationException”而终止应用程序,原因:“fb---AppID--- 未注册为 URL 方案。 Please add it in your Info.plist'请将其添加到您的 Info.plist'

The problem is the "fb---AppID---" is in my Info.plist file.问题是“fb---AppID---”在我的 Info.plist 文件中。 I followed the 3 bullet points listed in the FB Documentation shown here .我遵循了此处显示的 FB 文档中列出的 3 个要点。

I copied the app name and app id directly from the documentation.我直接从文档中复制了应用程序名称和应用程序 ID。 What am I doing wrong?我究竟做错了什么? Is there a step missing in the documentation?文档中是否缺少步骤? Did I not configure it correctly somewhere else?我在其他地方没有正确配置它吗?

在此处输入图片说明

I figured out the solution. 我找到了解决方案。 Do not copy and paste the App Name given to you on step 2 of the section titled "Configure your info.plist" on the facebook documentation . 请勿复制并粘贴在facebook文档中标题为“配置您的info.plist”部分的步骤2中提供给您的App Name。

I assumed it was the name of my ios project, but it's actually the App Name in your bundle identifier. 我以为它是我的ios项目的名称,但它实际上是您的包标识符中的App Name。 The only difference between the two was that the first character of the app name in my bundle identifier was not capitalized. 两者之间的唯一区别是我的包标识符中的应用名称的第一个字符未大写。

Another issue with that may be if you already integrated another login service like Google for ex, and you already have the "URL types" and "URL Schemas" in your info.plist 另一个问题可能是,如果您已经集成了另一个登录服务,例如Google,那么您的info.plist中已经有“URL类型”和“URL架构”

Make sure you looked the entire info.plist and not duplicating those nodes, just ad your Facebook data to the existing ones. 确保您查看整个info.plist而不是复制这些节点,只需将您的Facebook数据发布到现有的数据。

我通过查阅facebook文档解决了这个问题,我看到在应用程序的ID之前有fb前缀,而FacebookAppID没有。

从FacebookAppID中删除“fb”前缀(仅来自FacebookAppID)

即使在所有更改建议发生错误消息之后,在 iOS 上的 developer.facebook.com 和 info.plist 上创建了一个后缀后,在 FacebookUrlSuffix 字符串中插入了相同的代码,最后消息错误消失了

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

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