I am using Firebase dynamic link in my flutter app. I am allowing user to generate dynamic link in app that can be shared via sms/email/whatsApp etc etc. This link is working fine for Android but for iOS i am getting this exception.

Thanks in advance.

Below is my Xcode log.

[Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: {
    "_cpb" = 1;
    "_cpt" = cpit;
    "_fpb" = "XXAHEJ4DGgVlbXXXXX==";
    "_iumchkactval" = 1;
    "_iumenbl" = 1;
    "_osl" = "https://app.XXXXXXX.com/PPZbgKsKpKvukDWZ8";
    "_plt" = 1400;
    "_uit" = 1400;
    amv = 1;
    apn = "com.xxx.xxxx";
    cid = 000000;
    ibi = "com.xxx.xxxx";
    imv = 1;
    isi = X4967XXXXX;
    link = "https://app.xxxxx.com/data?userid=Bzhm1TScavV2&refcode=3DWIN11329206";
}

below are my firebase dynamic link details

Link name
Invite Friends

Deep link
https://app.xxxxx.com/data?userid=Bzhm1TScavV2&refcode=WIN11329206

Android app
com.xxx.xxxx

iOS app
com.xxx.xxxx

Long Dynamic Link
https://app.xxxxx.com/?link=https://app.xxxxx.com/data?userid%3DBzhm1TScavV2%26refcode%3DWIN11329206&apn=com.xxx.xxxx&isi=X4967XXXXX&ibi= com.xxx.xxxx

Short Dynamic Link
https://app.xxxxx.com/invitefriends 


Solution 1: Omatt

This issue seems to be present on older version of firebase_dynamic_links as discussed on this issue ticket. A workaround for this issue is to use app_links when the link is launched in iOS.

import 'dart:io' show Platform;

...

if (Platform.isIOS) {
  // Handle link using app_links in iOS
  initDynamicLinksIOS();
}
else {
  // Use the firebase_dynamic_links per usual
  initDynamicLinksAndroid();
}

Then use app_links to handle the deep link in iOS.

initDynamicLinkIOS() async {
  final _appLinks = AppLinks(
    // Called when a new uri has been redirected to the app
    onAppLink: (Uri deepLink) async {
      final PendingDynamicLinkData data =
          await FirebaseDynamicLinks.instance.getDynamicLink(deepLink);
      deepLink = data?.link;
      if (deepLink != null) {
        debugPrint('$deepLink');

        // Handle the deep link

      }
    },
  );
}