简体   繁体   English

在 iOS 上安装多种风格时,Firebase 动态链接无法打开正确的应用程序

[英]Firebase dynamic link not opening correct app when multiple flavors are installed on iOS

We developed a flutter app for Android and iOS, with different flavors: dev , test and prod , so we have 6 apps in total.我们为 Android 和 iOS 开发了一个 Flutter 应用程序,具有不同的风格: devtestprod ,所以我们总共有 6 个应用程序。 To on-board the user, we send a firebase dynamic link via Email (with a deep link inside it) to navigate the user to a specific screen when it is tapped.为了让用户加入,我们通过电子邮件发送一个 firebase 动态链接(其中包含一个深层链接),以便在用户点击时将其导航到特定屏幕。

The expected behavior is that when the user taps on a dynamic link of - say - the dev app, it opens a screen in the dev app.预期的行为是,当一个动态链接用户水龙头-比如说-在dev应用程序,它会打开在一个屏幕dev的应用程序。 Similar for the other flavors.其他口味类似。

Now this works just fine on Android.现在这在 Android 上工作得很好。 On iOS it works fine if only one app is installed, but if for example the dev and the test apps are installed, then tapping on the dynamic links always opens the test app.在 iOS 上,如果只安装了一个应用程序,它就可以正常工作,但如果安装了dev应用程序test应用程序,那么点击动态链接总是会打开测试应用程序。 This is also true when dev , test and prod are installed: test is opened.安装devtestprod时也是如此:打开了test

This is a development issue and not relevant for production as the user will never have the test or dev app installed, but it is annoying us as we have to uninstall and reinstall flavors all the time.这是一个开发问题,与生产无关,因为用户永远不会安装测试或开发应用程序,但这让我们很烦,因为我们必须一直卸载和重新安装风味。

Our dynamic links have the following format (values in '<>' are placeholders):我们的动态链接具有以下格式(“<>”中的值是占位符):

Dev:  https://<app_id>.page.link/?link=http://dev.<mydomain>.com/reset?token=token1&apn=<mypackage>.dev&isi=<isiNumber1>&ibi=<mypackage>.dev
Test: https://<app_id>.page.link/?link=http://test.<mydomain>.com/reset?token=token2&apn=<mypackage>.test&isi=<isiNumber2>&ibi=<mypackage>.test
Prod: https://<app_id>.page.link/?link=http://<mydomain>.com/reset?token=token3&apn=<mypackage>&isi=<isiNumber3>&ibi=<mypackage>

The behavior is the same for all iOS versions I could get my hands on on real devices, ie iOS 11, 12 and 13. We're using Flutter 1.9.1-hotfix6 and firebase_dynamic_links 0.5.0+1我可以在真实设备上使用的所有 iOS 版本的行为都是相同的,即 iOS 11、12 和 13。我们使用 Flutter 1.9.1-hotfix61.9.1-hotfix6 firebase_dynamic_links 0.5.0+1

Any ideas what this might be caused by?任何想法这可能是由什么引起的?

Firebase Dynamic Links do not support using the same URL prefix for multiple iOS apps/targets contained in the same Firebase project. Firebase 动态链接不支持对包含在同一 Firebase 项目中的多个 iOS 应用/目标使用相同的网址前缀。

You can workaround this in multiple ways though:不过,您可以通过多种方式解决此问题:

  1. Using multiple (sub)domains (as already suggested by Janmenjaya )使用多个(子)域(正如Janmenjaya 已经建议的那样

  2. Use a custom domain使用自定义域

  3. Using multiple Firebase projects (as already suggested by Aleksandr )使用多个 Firebase 项目(正如Aleksandr 已经建议的那样


On Android it works out of the box, because you are in charge of matching paths with particular apps within the Manifest file.在 Android 上,它开箱即用,因为负责将路径与清单文件中的特定应用程序匹配。 On iOS it doesn't work, because Firebase is in charge of such matches within the hosted apple-app-site-association file.在 iOS 上它不起作用,因为Firebase负责托管apple-app-site-association文件中的此类匹配。


For further information, I've written an extensive answer here .有关更多信息,我在这里了一个广泛的答案

不要在firebase控制台中使用一个项目,最好在<key>com.apple.developer.associated-domains</key>拆分使用不同的url

In Firebase under dynamic link, we can create multiple url domain.在 Firebase 的动态链接下,我们可以创建多个 url 域。 And these url domain we need to add in the associated domain of different target.而这些url域我们需要添加到不同target的关联域中。

Steps脚步

Let's assume I have two target test and production.假设我有两个目标测试和生产。

I created two domain link like “test.page.link” and production.page.link我创建了两个域链接,如“test.page.link”和 production.page.link

In test target in Xcode under Signing & Capabilities -> Associated Domain, use the “test.page.link”在 Xcode 中 Signing & Capabilities -> Associated Domain 下的测试目标中,使用“test.page.link”

And for production target set the production.page.link并为生产目标设置 production.page.link

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

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