Flutter Firebase dynamic links on IOS not working: [Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params

Viewed 1394

I'm trying to use dynamic links in my flutter app to invite new users.
It works fine on Android but, It does not workin on IOS.
the message is:

2021-08-30 15:31:09.260470+0900 Runner[9221:902508] 8.3.0 - [Firebase/Analytics][IACS023001] Deep Link does not contain valid required params. URL params: {  
    "_cpb" = 1;  
    "_cpt" = cpit;  
    "_fpb" = "CJsFEPcCGgVrby1rcg==";  
    "_iumchkactval" = 1;  
    "_iumenbl" = 1;  
    "_osl" = "https://myapp.page.link/ryZWzXFzVqY3sjE4A";  
    "_plt" = 981;  
    "_uit" = 2105;  
    apn = "com.example.myapp";  
    cid = 2464839987823306368;  
    ibi = "com.example.myappios";  
    isi = app store id;  
    link = "https://invite.friends.myapp/invite_from?uid={uid_string}";  
}

My codes:

Generating dynamic links

String? uid = FirebaseAuth.instance.currentUser?.uid;
                  final DynamicLinkParameters parameters =
                      DynamicLinkParameters(
                    uriPrefix: 'https://potendogs.page.link',
                    link: Uri.parse(
                        'https://invite.friends.myapp/invite_from?uid=$uid'),
                    androidParameters: AndroidParameters(
                      packageName: 'com.example.myapp',
                    ),
                    iosParameters: IosParameters(
                      bundleId: 'com.example.myappios',
                      appStoreId: 'app store id',
                    ),
                  );
                  final ShortDynamicLink shortUrl =
                      await parameters.buildShortLink();
                  Share.share('invite_message'.tr() + shortUrl.shortUrl.toString());

Receiving dynamic links

void initDynamicLinks() async {
    FirebaseDynamicLinks.instance.onLink(
        onSuccess: (PendingDynamicLinkData? dynamicLink) async {
      final Uri? deepLink = dynamicLink?.link;

      if (deepLink != null) {
        String? uid = FirebaseAuth.instance.currentUser?.uid;
        String? ownerUid = deepLink.queryParameters['uid'];
        if (uid != null && ownerUid != null) {
          _inviteCouponBloc
              .add(NewUserInviteCouponEvent(uid: uid, ownerUid: ownerUid));
        }
      }
    }, onError: (OnLinkErrorException e) async {
      print('OnLinkError');
      print(e.message);
      print(e.stacktrace);
    });

    final PendingDynamicLinkData? data =
        await FirebaseDynamicLinks.instance.getInitialLink();
    final Uri? deepLink = data?.link;

    if (deepLink != null) {
      if (widget.isNewUser) {
        String? uid = FirebaseAuth.instance.currentUser?.uid;
        String? ownerUid = deepLink.queryParameters['uid'];
        if (uid != null && ownerUid != null) {
          _inviteCouponBloc
              .add(NewUserInviteCouponEvent(uid: uid, ownerUid: ownerUid));
        } else {
          print('firebase uid is null');
        }
      }
    }
  }

I call initDynamicLinks() in initState()

The Generated dynamic link(short) look like this: https://myapp.page.link/Df6MA2Xf34CTENgs9 But in IOS, some log shows how IOS get dynamic links link this

"iOS handleLink: https://myapp.page.link/?link=https://invite.friends.myapp/invite_from?uid%3D66kWqpCU1ddHfErvtyucOHK3KoI3&apn=com.example.myapp&isi={app store id}&ibi=com.example.myappios&cid=2464839987823306368&_osl=https://myapp.page.link/ryZWzXFzVqY3sjE4A&_fpb=CJsFEPcCGgVrby1rcg==&_cpt=cpit&_iumenbl=1&_iumchkactval=1&_plt=981&_uit=2105&_cpb=1"

how can I solve this problem?

note
I have different ios and android bundle id.
android bundle id: com.example.myapp
ios bundle id: com.example.myappios

I filled every inputs on firebase console.

additionally, There's warning when i generate dynamic links like:
[Android app 'com.example.myappios' lacks SHA256. AppLinks is not enabled for the app. [https://firebase.google.com/docs/dynamic-links/debug#android-sha256-absent],

iOS app 'com.example.myapp' lacks App ID Prefix. UniversalLinks is not enabled for the app. [https://firebase.google.com/docs/dynamic-links/debug#ios-team-id-absent],

There is no configuration to prevent phishing on this domain https://myapp.page.link. Setup URL patterns to whitelist in the Firebase Dynamic Links console. [https://support.google.com/firebase/answer/9021429]]

edit

The variable deepLink from dynamicLink?.link and
await FirebaseDynamicLinks.instance.getInitialLink()?.link is null

1 Answers

Check if an external API or service are modifying your url.

In my case a payment api modify the url and iOS devices crashed.

Related