Firebase short dynamic link not working in iOS (being treated as a deeplink)

Issue

I have dynamic links working fine on Android and the long dynamic link works as expected on iOS but for some reason I can’t get the short dynamic link to work on iOS.

It seems to be treating the link as a normal deeplink.

Short link (does not work on ios, ok on Android):
https://go.xxxxx.app/3Xou

Long link (works):
https://go.xxxxx.app/?link=https://member.xxxxx.app/register?tenant-slug%3Dmtbcats&apn=app.xxxxx.xxxxx&isi=1573527302&ibi=app.xxxxx.xxxxx&efr=1

Any ideas on why this is not working?

I realise there are several other questions on this but none of the answers helped me.

Other info

I have completed steps 1-3 from this document https://firebase.google.com/docs/dynamic-links/ios/receive?authuser=0#open-dynamic-links-in-your-app
but not steps 4-7 as I don’t believe I need to do those for an Ionic Capacitor app

I am using a physical iPhone 8 with iOS 15.4.1

This is my deeplink which works fine if I click the url on my device:
https://member.xxxxx.app

I have an app association file set up here:
https://go.xxxxx.app/.well-known/apple-app-site-association
I also set it here as I wasn’t sure whether to set it up for the dynamic link as well:
https://member.xxxxx.app/.well-known/apple-app-site-association

This is the contents of my app association file:

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "myAppId.app.xxxxx.xxxxx",
        "paths": ["*"]
      }
    ]
  }
}

I have the following Associated Domains set up in Xcode:
applinks:go.xxxxx.app
applinks:go.xxxxx.app?mode=developer
applinks:member.xxxxx.app
applinks:member.xxxxx.app?mode=developer

I have the capability associated domains turned on in my Apple Developer identifier.

My app is published to the app store but not the latest version of the app with the associated domain member.xxxxx.app and go.xxxxx.app.

I have added my app and team id to Firebase on the ios app.

I have "Associated Domains Development" turned on in the developer settings of my iPhone.

I added FirebaseDynamicLinksCustomDomains in my info.plist as mentioned here:
https://firebase.google.com/docs/dynamic-links/custom-domains#set_up_a_custom_domain_in_the

Under Xcode -> Info I have added a URL Type with the url Scheme app.xxxxx.xxxxx

Solution

It turns out I needed to install a Capacitor Dynamic Links package for the short links to work in iOS.
https://www.npmjs.com/package/@pantrist/capacitor-firebase-dynamic-links

All I need to was install it and add the following function and it worked fine:

   FirebaseDynamicLinks.addListener('deepLinkOpen', (data) => {
       console.log(data);
   });

Before I was doing it like this:

   import { App, URLOpenListenerEvent } from '@capacitor/app';

   App.addListener('appUrlOpen', (data: any) => {
      console.log(data)
   });

Note:
The dynamic link only works from the app store (no app installed) if the dynamic link has the preview set to on.

Answered By – MadMac

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published