AppsFlyerSDK / appsflyer-flutter-plugin

Flutter Plugin for AppsFlyer SDK
MIT License
142 stars 111 forks source link

"generateInviteLink" on [iOS] return unexpected link while on [Android] the link is correct #262

Open BenBoonya opened 1 year ago

BenBoonya commented 1 year ago

Describe the bug On appsflyer_sdk: ^6.10.3

The link created from the function generateInviteLink on iOS (via Flutter SDK) turn out to be the offline link as told by AppsFlyer support.

The link with the same param on Android and iOS.

Android https://dev-myapp.onelink.me/ABCD/h31b26w1

iOS https://dev-myapp.onelink.me/ABCD?af_dp=myapp%3A%2F%2Fonline%2Fproducts%2F400&af_channel=app_invite&af_referrer_customer_id=1234567891234-12345&af_og_description=%3Cp%3E%3Cstrong%3E%E0%B8%AA%E0%B8%94%20%E0%B8%AA%E0%B8%B0%E0%B8%AD%E0%B8%B2%E0%B8%94%20%E0%B8%95%E0%B8%A3%E0%B8%87%E0%B8%95%E0%B8%B2%E0%B8%A1%E0%B8%9E%E0%B8%B1%E0%B8%99%E0%B8%98%E0%B8%B8%E0%B9%8C%20%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99%E0%B8%A1%E0%B8%B0%E0%B8%99%E0%B8%B2%E0%B8%A7%E0%B8%9E%E0%B8%B7%E0%B9%89%E0%B8%99%E0%B9%80%E0%B8%A1%E0%B8%B7%E0%B8%AD%E0%B8%87%E0%B8%82%E0%B8%AD%E0%B8%87%E0%B9%84%E0%B8%97%E0%B8%A2%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%95%E0%B8%A5%E0%B8%B2%E0%B8%94%E0%B8%99%E0%B8%B4%E0%B8%A2%E0%B8%A1%E0%B8%A1%E0%B8%B2%E0%B8%81%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%AA%E0%B8%B8%E0%B8%94%E0%B8%9E%E0%B8%B1%E0%B8%99%E0%B8%98%E0%B8%B8%E0%B9%8C%E0%B8%AB%E0%B8%99%E0%B8%B6%E0%B9%88%E0%B8%87%20%E0%B8%9C%E0%B8%A5%E0%B9%83%E0%B8%AB%E0%B8%8D%E0%B9%88%20%E0%B8%A1%E0%B8%B5%E0%B8%AA%E0%B8%B5%E0%B9%80&c=app_invite&af_og_title=%E0%B8%A1%E0%B8%B0%E0%B8%99%E0%B8%B2%E0%B8%A7%E0%B9%81%E0%B8%9B%E0%B9%89%E0%B8%99%20%E0%B9%80%E0%B8%9A%E0%B8%AD%E0%B8%A3%E0%B9%8C%20400%20%E0%B8%84%E0%B8%B1%E0%B8%94%E0%B8%95%E0%B8%B1%E0%B8%94%E0%B9%81%E0%B8%95%E0%B9%88%E0%B8%87%20%28%E0%B9%80%E0%B8%9B%E0%B8%A5%E0%B8%B7%E0%B8%AD%E0%B8%81%E0%B9%80%E0%B8%82%E0%B8%B5%E0%B8%A2%E0%B8%A7%E0%B8%AA%E0%B8%A7%E0%B8%A2%29%20-%2010%20%E0%B8%A5%E0%B8%B9%E0%B8%81&deep_link_value=myapp%3A%2F%2Fonline%2Fproducts%2F400&af_referrer_name=&af_og_image=https%3A%2F%2Fmyimage.com%2Fmedia%2Fproduct%2F%2Fbanner%2F62lqcugx0oaca1j8jaw56wuachwj&af_referrer_image_url=&pid=af_app_invites&af_referrer_uid=1234567891234-1234567&af_siteid=222221111}}

The link value is replace by dummy value but idea is the link generated from iOS should be the same as Android.

To Reproduce Steps to reproduce the behavior:

On iOS

  1. Init AppsFlyer SDK
 AppsFlyerOptions appsFlyerOptions = AppsFlyerOptions(
        afDevKey: devKey,
        appId: appId,
        showDebug: true,
        timeToWaitForATTUserAuthorization: 60,
        // for iOS 14.5
        appInviteOneLink: oneLinkID,
        // Optional field
        disableAdvertisingIdentifier: false,
        // Optional field
        disableCollectASA: false);

await _appsFlyerSdk?.initSdk(
      registerConversionDataCallback: true,
      registerOnAppOpenAttributionCallback: true,
      registerOnDeepLinkingCallback: true,
);
  1. Create app invite link.
 AppsFlyerInviteLinkParams inviteLinkParams = AppsFlyerInviteLinkParams(
        channel: "app_invite",
        referrerName: "",
        baseDeepLink: deeplinkValue,
        brandDomain: "",
        customerID: uid ?? "",
        referreImageUrl: "",
        campaign: "app_invite",
        customParams: {
          "af_og_image": imageUrl,
          "af_og_title": title,
          "af_og_description": description.characters.take(80).toString(),
          "af_dp": deeplinkValue,
          "deep_link_value": deeplinkValue,
        });

    _appsFlyerSdk?.generateInviteLink(inviteLinkParams, (result) {
      var link = result['payload']['userInviteURL'];
      onLinkCreated(link);
    }, (error) {
      debugPrint(error);
   });
  1. Check result

result['payload']['userInviteURL'];

  1. See error The userInviteURL different from on Android. The url include all detail in the queryParam

Expected behavior The userInviteURL should be the same as Android in this format https://dev-myapp.onelink.me/ABCD/h31b26w1

Smartphone (please complete the following information):

  1. Device: iPhone 11, OS: iOS 15.1
  2. Device: iPad Pro (11-inch) (3rd gen), OS: iOS 16.3.1

Additional context Logs from Android studio

Screenshot 2566-05-09 at 15 36 21

Screenshot 2566-05-09 at 15 36 45

raulmabe-labhouse commented 4 months ago

@BenBoonya Did you fix it?

raulmabe-labhouse commented 4 months ago

For anyone wondering, just remove the brandDomain: "". Leave it null

esentis commented 4 months ago

Is this iOS specific because I can see some Android users of mine with the same behaviour.

vanvixi commented 3 months ago

I encountered a similar issue as yours, and after several days of investigation, I identified the problem lying within the brandDomain parameter in AppsFlyerInviteLinkParams.

"If brandDomain.isEmpty == true or you haven't registered brandDomain or brandDomain hasn't been configured successfully, it will result in an error preventing the creation of a shortened link." (brandDomain must be accurately configured here).

To resolve this issue, you simply need to remove the brandDomain or set brandDomain: null.

Befor:

      final AppsFlyerInviteLinkParams inviteLinkParams = AppsFlyerInviteLinkParams(
        brandDomain: _brandDomain,
        customerID: customerID,
        customParams: customParams,
        ...
      );

Resolved:

      final AppsFlyerInviteLinkParams inviteLinkParams = AppsFlyerInviteLinkParams(
        customerID: customerID,
        customParams: customParams,
        ...
      );