HomeiOS Developmentjavascript - Sending `onInstallConversionDataLoaded` with no listeners registered AppsFlyer

javascript – Sending `onInstallConversionDataLoaded` with no listeners registered AppsFlyer


I get the error

Sending onInstallConversionDataLoaded with no listeners registered

when making an attempt to unmount the InstallConversion listener from AppsFlyer. Right here is my code:

import React, { useEffect } from 'react';
import appsFlyer from 'react-native-appsflyer';
import NonRenderOnChangeData from '../nonRenderOnChangeData/NonRenderOnChangeData';
import { useFocusEffect } from '@react-navigation/native';

operate AppsFlyerHandler({ navigation }) {
  useFocusEffect(() => {
   // Configure listeners earlier than initializing SDK
      const onInstallConversionDataCanceller = appsFlyer.onInstallConversionData(
      (res) => {
        console.log("res", res);
        if (JSON.parse(res.information.is_first_launch) == true) {
          if (res.information.af_status === 'Non-organic') {
            if (NonRenderOnChangeData.userIsEligableForCampaign()) {
              this.props.navigation.navigate('LoadingPage', {entitlementID: res.information.marketing campaign});
            }
            console.log('That is first launch and a Non-Natural set up. Media supply: ' + media_source + ' Marketing campaign: ' + marketing campaign);
          } else if (res.information.af_status === 'Natural') {
            console.log('That is first launch and a Natural Set up');
          }
        } else {
            console.log('This isn't first launch');
        }
      }
    );

    const onAppOpenAttributionCanceller = appsFlyer.onAppOpenAttribution((res) => {
      if ("deep_link_value" in res.information) {
        if (NonRenderOnChangeData.userIsEligableForCampaign()) {
          this.props.navigation.navigate('LoadingPage', {entitlementID: res.information.deep_link_value});
        }
      }
    });

    // Initialize AppsFlyer right here
    appsFlyer.initSdk(
      {
        devKey: 'xxxxxxxx',
        isDebug: true,
        appId: 'xxxxxxx',
        onInstallConversionDataListener: true,
      },
      (end result) => {
        console.log("AppsFlyer Init",end result);
      },
      (error) => {
        console.error("AppsFlyer Init",error);
      }
    );

    return () => {
      onInstallConversionDataCanceller();
      onAppOpenAttributionCanceller();
    };
  }); 

  return null;
}

export default AppsFlyerHandler;

I’ve tried following all guides and documentation however nonetheless appear to get this warning regardless of how I do it. I’ve tried to take away the listener the identical means because the documentation, like down beneath, however nonetheless get the identical warning. Does anyone know an answer?

 if (onInstallConversionDataCanceller) {
 onInstallConversionDataCanceller();
 console.log('unregister onInstallConversionDataCanceller');
 onInstallConversionDataCanceller = null;
 }
 if (onAppOpenAttributionCanceller) {
 onAppOpenAttributionCanceller();
 console.log('unregister onAppOpenAttributionCanceller');
 onAppOpenAttributionCanceller = null;
 } 

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments