Firebase 动态链接无法打开 iOS 应用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37724415/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 09:18:37  来源:igfitidea点击:

Firebase dynamic link not opening the app iOS

iosfirebasefirebase-dynamic-links

提问by kalpeshdeo

I have developed & installed an iOS app locally on my device.

我已经在我的设备上本地开发并安装了一个 iOS 应用程序。

And have set custom scheme in the info.plist as mydlink

并将 info.plist 中的自定义方案设置为 mydlink

Set associated domains as weel: applinks:<myapp>.app.goo.gl

将关联域设置为: applinks:<myapp>.app.goo.gl

Created dynamic link on firebase as:

在 firebase 上创建动态链接为:

https://<myapp>.app.goo.gl/?link=http://<mysite.com>/&ibi=<app bundle id>&ius=mydlink&ifl=https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id%3D<app store id>%26mt%3D8&pt=<app store id>

When I open or click on dynamic link, it opens app page in the "App Store" app and not opening app itself though its installed.

当我打开或单击动态链接时,它会在“App Store”应用程序中打开应用程序页面,而不是打开应用程序本身,尽管它已安装。

What am I missing here?

我在这里缺少什么?

回答by Heinrisch

If you are on iOS 9, universal links will be used. Universal links don't work in a lot of cases, like:

如果您使用的是 iOS 9,则将使用通用链接。通用链接在很多情况下不起作用,例如:

  • If you use a simulator
  • If you try to open the link directly in safari on a device (typing it into the address field in the browser)
  • 如果你使用模拟器
  • 如果您尝试在设备上的 safari 中直接打开链接(将其输入到浏览器的地址字段中)

I spent a lot of time trying this and could never get it to work on a simulator in a reliable way. What I end up doing is emailing the link to me and opening it from Inbox. Then it works every time!

我花了很多时间尝试这个,但永远无法以可靠的方式让它在模拟器上工作。我最终做的是通过电子邮件将链接发送给我并从收件箱打开它。然后它每次都有效!

回答by iamthearm

I'm sorry for the late reply - I hope your issue has been resolved and that this is helpful to others who may be experiencing the same problem.

很抱歉回复晚了 - 我希望您的问题已得到解决,并且这对可能遇到相同问题的其他人有所帮助。

There could actually be one or more issues here for iOS 9+; Dynamic Links relies on Apple's Universal Links to open the app on iOS 9+ and these suggestions are aimed at resolving issues with Universal Links and Firebase and have nothing to do with the SDK directly.

对于 iOS 9+,这里实际上可能存在一个或多个问题;Dynamic Links 依赖 Apple 的 Universal Links 在 iOS 9+ 上打开应用程序,这些建议旨在解决 Universal Links 和 Firebase 的问题,与 SDK 没有直接关系。

  1. Verify that the assoc file is correct at https://app_id.app.goo.gl/apple-app-site-association - it should look similar to https://maps.app.goo.gl/apple-app-site-associationbut with only one element in "details."
  2. As pointed out by another answer, verify that your team ID is properly set in the Firebase console.
  3. If you've long-pressed the link and then clicked "Open in Safari" or you have clicked the "goo.gl>" button on the status bar of your app after the app opens via a Universal Link, then iOS defaults to opening Universal Links in Safari. This can be fixed by pulling down on the paged opened in Safari and clicking "Open in App" (or similar) on the smart banner.
  1. 在 https:// app_id.app.goo.gl/apple-app-site-association验证 assoc 文件是否正确- 它应该类似于https://maps.app.goo.gl/apple-app-site -association但在“细节”中只有一个元素。
  2. 正如另一个答案所指出的,请验证您的团队 ID 是否在 Firebase 控制台中正确设置。
  3. 如果您长按链接然后单击“在 Safari 中打开”,或者在通过通用链接打开应用程序后单击应用程序状态栏上的“goo.gl>”按钮,则 iOS 默认为打开Safari 中的通用链接。这可以通过下拉在 Safari 中打开的分页并单击智能横幅上的“在应用程序中打开”(或类似内容)来解决。

The "ibi" parameter is not involved in opening the app in a post-install click on iOS 9+, but is in prior versions when the "ius" param is not set.

“ibi”参数不参与在 iOS 9+ 上的安装后点击中打开应用程序,但在未设置“ius”参数的早期版本中。

Regarding iOS 8, can you try running the app and then clicking a link after the app is installed? On versions prior to iOS 9, you can test by copy/pasting the link into safari.

关于iOS 8,您可以尝试运行该应用程序,然后在安装该应用程序后单击链接吗?在 iOS 9 之前的版本上,您可以通过将链接复制/粘贴到 safari 中进行测试。

https://firebase.google.com/docs/dynamic-links/ios

https://firebase.google.com/docs/dynamic-links/ios

回答by protspace

sometimes we make a mistake in Associated Domains entitlements. There have to be no spaces

有时我们会在关联域权限中出错。必须没有空格

applinks:mydomain.page.link

回答by icould

I experienced same problem. Interestingly if you open the dynamic link in Chrome, app starts directly and successfully. But in Safari always it tries to open AppStore although the app is installed. I have no idea why Safari doesn't work in this case.

我遇到了同样的问题。有趣的是,如果您在 Chrome 中打开动态链接,应用程序将直接成功启动。但是在 Safari 中,尽管安装了该应用程序,它还是会尝试打开 AppStore。我不知道为什么 Safari 在这种情况下不起作用。

回答by dacoinminster

Firebase dynamic links were not working for us (on iOS9 where they use universal links) due to a problem in Firebase's assumptions during setup. Here's how we fixed the problem on our app:

由于 Firebase 在设置过程中的假设存在问题,Firebase 动态链接对我们不起作用(在 iOS9 上使用通用链接)。以下是我们解决应用程序问题的方法:

Firebase asks for your "Team ID" when adding your iOS app to Firebase Console Project Settings, and it assumes that your unique app ID will be in the format TeamID.com.foo.bar

在将您的 iOS 应用添加到 Firebase 控制台项目设置时,Firebase 会要求您提供“团队 ID”,并且它假定您的唯一应用 ID 的格式为 TeamID.com.foo.bar

However, in our case, that was NOT our unique app ID. When I looked at our provisioning profile (on developer.apple.com I found our provisioning profile and clicked "edit"), I saw that our unique app ID was actually SomethingElse.com.foo.bar

但是,在我们的例子中,这不是我们唯一的应用程序 ID。当我查看我们的配置文件时(在 developer.apple.com 上我找到了我们的配置文件并单击了“编辑”),我看到我们唯一的应用程序 ID 实际上是 SomethingElse.com.foo.bar

I had to go into Firebase Console and enter that "SomethingElse" in the spot where it asked for Team ID, even though that was NOT our team ID. Once I made that change, Firebase Dynamic Links started working correctly.

我不得不进入 Firebase 控制台并在它要求输入团队 ID 的地方输入“SomethingElse”,即使那不是我们的团队 ID。做出更改后,Firebase 动态链接开始正常工作。

It appears Firebase is making an assumption that your unique app ID will always start with your Team ID, which is apparently not always the case.

Firebase 似乎假设您的唯一应用 ID 将始终以您的团队 ID 开头,但显然情况并非总是如此。

Note that changing your Team ID can take a significant amount of time to take effect. You can see that the change has happened by checking the appropriate link for your app_id (https://app_id.app.goo.gl/apple-app-site-association).

请注意,更改您的团队 ID 可能需要很长时间才能生效。您可以通过检查 app_id 的相应链接 ( https://app_id.app.goo.gl/apple-app-site-association)来查看更改已发生。

回答by Abhijeet Jaiswal

If none of the above workarounds work for you, please check if you have added activitycontinuation in associated domains or not.

如果上述解决方法都不适合您,请检查您是否在关联域中添加了活动继续。

Followin image shows the exact place where you have to add that(if you havn't done that already)

下图显示了您必须添加的确切位置(如果您还没有这样做)

回答by Hymanson Smith

Hello guys i have a great new.

大家好,我有一个很棒的新人。

I always listen that it's IMPOSSIBLEtest a dynamic link on simulator.

我总是听说在模拟器上测试动态链接是不可能的

But we discovered this, and now WE CAN test firebase dynamic link on simulator

但是我们发现了这一点,现在我们可以在模拟器上测试 firebase 动态链接

https://stackoverflow.com/a/56385506/6273003

https://stackoverflow.com/a/56385506/6273003

回答by Iris Veriris

Experienced the same problem.

遇到了同样的问题。

The solution for me was to use the

我的解决方案是使用

Identifiers -> App IDs -> 'my.app.ID' -> Prefix

标识符 -> 应用 ID -> 'my.app.ID' -> 前缀

You can find it on: https://developer.apple.com/account/ios/identifier/bundle

您可以在以下位置找到它:https: //developer.apple.com/account/ios/identifier/bundle

Instead of the 'DevelopmentTeam'number from the .pbxprojwhich I used and add it to the Team IDfor my iOS app in the Firebase console.

而不是我使用的'DevelopmentTeam'编号,并将.pbxproj其添加到Team IDFirebase 控制台中的 iOS 应用程序。

And don't forget to download and add a new .plist to the project.

并且不要忘记下载并将新的 .plist 添加到项目中。

回答by Pankaj Jangid

When link is open in safari, It shows a "open (project name)"button. If this button is pressed for 2-3 second, It asks for opening that into different apps for first time.It also shows your app name. If you select your app, It opens your app. After doing that if you again open this link and press button in safari, it always work fine.

当链接在 safari 中打开时,它会显示一个“打开(项目名称)”按钮。如果按住此按钮 2-3 秒,它会要求首次将其打开到不同的应用程序中。它还显示您的应用程序名称。如果您选择您的应用程序,它会打开您的应用程序。这样做之后,如果您再次打开此链接并在 safari 中按下按钮,它总是可以正常工作。

This fixed the problem for me.

这为我解决了问题。

回答by Vladimir Grigorov

After integrating Firebase Dynamic links, the sample link started working immediately on a device with iOS 8. For iOS 9 devices Universal links mechanism is used, as mentioned by other answers. This means Apple needs to update the entitlement data used to verify deep link dual authentication. This may take 48 hours, according to Apple's App Search API Validation Tool.

集成 Firebase 动态链接后,示例链接立即在装有 iOS 8 的设备上开始工作。对于 iOS 9 设备,使用通用链接机制,如其他答案所述。这意味着 Apple 需要更新用于验证深度链接双重身份验证的授权数据。根据 Apple 的App Search API 验证工具,这可能需要 48 小时。

There are more Universal links troubleshooting tips here.

有故障排除技巧更通用的链接在这里