SOERGI
SOERGI

Reputation: 193

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. 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.

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. Similar for the other flavors.

Now this works just fine on 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. This is also true when dev, test and prod are installed: test is opened.

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, i.e. iOS 11, 12 and 13. We're using Flutter 1.9.1-hotfix6 and firebase_dynamic_links 0.5.0+1

Any ideas what this might be caused by?

Upvotes: 0

Views: 2901

Answers (3)

Johnson_145
Johnson_145

Reputation: 2032

Firebase Dynamic Links do not support using the same URL prefix for multiple iOS apps/targets contained in the same Firebase project.

You can workaround this in multiple ways though:

  1. Using multiple (sub)domains (as already suggested by Janmenjaya)

  2. Use a custom domain

  3. Using multiple Firebase projects (as already suggested by Aleksandr)


On Android it works out of the box, because you are in charge of matching paths with particular apps within the Manifest file. On iOS it doesn't work, because Firebase is in charge of such matches within the hosted apple-app-site-association file.


For further information, I've written an extensive answer here.

Upvotes: 2

Janmenjaya
Janmenjaya

Reputation: 4163

In Firebase under dynamic link, we can create multiple url domain. And these url domain we need to add in the associated domain of different 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

In test target in Xcode under Signing & Capabilities -> Associated Domain, use the “test.page.link”

And for production target set the production.page.link

Upvotes: 1

Aleksandr
Aleksandr

Reputation: 11

Do not use one project in the firebase console, it is better to split and use different url in <key>com.apple.developer.associated-domains</key>

Upvotes: 1

Related Questions