【问题标题】:Add the Association Domains feature to your App Id?将关联域功能添加到您的应用程序 ID?
【发布时间】:2018-01-25 14:35:19
【问题描述】:
我正在尝试实现 Firebase 动态链接。
- 我在 Firebase 控制台上创建了项目并提供了所需的
值(prefx 和 appid)。
- 我还允许来自开发者控制台的关联域
并成功显示真旗。
- 在xcode中我有关联域的特性,并添加了url标识符等。
问题:我面临的问题仍然是关联域部分说
将关联域功能添加到您的 App ID。
不知道我收到此错误的原因是什么。
还附上屏幕截图以供证明。
【问题讨论】:
标签:
swift
firebase
firebase-dynamic-links
【解决方案2】:
我遇到了类似的问题。当我关闭并打开Capabilities 中的功能时,问题就解决了。但是后来我在不同的文件夹中有几个权利文件。将这些文件合二为一的步骤:
- 在文本编辑器中打开
MY_PROJECT_NAME.xcodeproj\project.pbxproj
- 找到
CODE_SIGN_ENTITLEMENTS 并设置正确的路径。示例:
“MY_PROJECT_NAME/Entitlements/MY_TARGET_NAME.entitlements”
我不建议使用标准的文本编辑器,因为它会在保存时自动替换文件中的某些字符。
【解决方案3】:
您需要将关联域添加到您的应用功能。请看截图。添加applinks:yourdomain.com
然后使用下面的代码获取短网址
guard let link = URL(string: "https://www.yourdomain.com/share_location.html?Id=\(RandomID)&uid=\(uid)") else { return }
let dynamicLinksDomain = "yourdomain.page.link"
let components = DynamicLinkComponents(link: link, domain: dynamicLinksDomain)
// [START shortLinkOptions]
let options = DynamicLinkComponentsOptions()
options.pathLength = .unguessable
components.options = options
// [END shortLinkOptions]
// [START shortenLink]
components.shorten { (shortURL, warnings, error) in
// Handle shortURL.
if let error = error {
print(error.localizedDescription)
return
}
print(shortURL?.absoluteString ?? "")
}