AppsFlyerSDK / appsflyer-react-native-plugin

AppsFlyer plugin for React Native
MIT License
278 stars 198 forks source link

Track uninstall not working on iOS after update react-native from version 0.70.15 to 0.71.18 #569

Open danielreisSL opened 1 month ago

danielreisSL commented 1 month ago

Report

I can't see any iOS uninstalls after I updated the react-native version from 0.70.15 to 0.71.18.

image

Plugin Version

^6.14.3

On what Platform are you having the issue?

iOS

What did you do?

I updated the react-native version from 0.70.15 to 0.71.18

What did you expect to happen?

I was expecting to see the log on Xcode:

[com.appsflyer.serial] [REGISTER UNINSTALL] URL: https://8wtdmf-register.appsflyersdk.com/api/v6.14/iosevent?buildnumber=6.14.3&app_id=myappid (with token: 74cf8d05a1993d38bf85d60acbd5c6731684d7275d11f90ed12e94ecdbc1a444)

What happened instead?

I did not receive any [REGISTER UNINSTALL] log on Xcode.

Other relevant information.

  1. I have already checked the .p12 certificate, and it is valid.
  2. In version 0.70, I always see the log [REGISTER UNINSTALL] when running with the flag isDebug: true. I don't need to accept the requestTracking and requestPushNotification to see this log in Xcode.
  3. In version 0.71, even if I accept requestTracking and requestPushNotification, I don't see this log in Xcode.
  4. I follow the Upgrade Helper to upgrade react-native
  5. I have already tried adding these reasons to the file PrivacyInfo.xcprivacy.
  6. I did not see any log related to register.appsflyersdk.com on version 0.71
  7. I also try to update the APNS token using the function appsFlyer.updateServerUninstallToken(token); but in both versions, it returns the log [com.appsflyer.serial] Uninstall token didn't change. Ignoring new token on Xcode
  8. Note on my code below that I added a NSLog before register uninstall token, on both version I see the log: didRegisterForRemoteNotificationsWithDeviceToken: {length = 32, bytes = 0xae9c2a4c 3619ef91 4fc374e4 2cba427f ... 021ea629 112a1331 } on Xcode then I don't know why AppsFlyer isn't get the token, since the call for registration is right after the log

Does anyone have a clue? I don't know what else to look for.

Modifications

Version 0.70:

AppDelegate.h

#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>
#import <React/RCTBridge.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, UNUserNotificationCenterDelegate>

@property(nonatomic, strong) UIWindow *window;
@property(nonatomic, strong) RCTBridge *bridge;
@end

Version 0.71:

AppDelegate.h

#import <RCTAppDelegate.h>
#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>
#import <React/RCTBridge.h>

@interface AppDelegate : RCTAppDelegate

@property(nonatomic, strong) RCTBridge *bridge;
@end

Version 0.70:

AppDelegate.mm

#import "AppDelegate.h"
#import "RNCConfig.h"
#import "Orientation.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTAppSetupUtils.h>
#import <Firebase.h>
#import "RNBootSplash.h"
#import <RNGoogleSignin/RNGoogleSignin.h>
#import <CodePush/CodePush.h>
#import <AuthenticationServices/AuthenticationServices.h>
#import <SafariServices/SafariServices.h>
#import <FBSDKCoreKit/FBSDKCoreKit-Swift.h>
#import <React/RCTLinkingManager.h>

#import <React/RCTRootView.h>
#import <React/RCTBridge.h>
#import <React/RCTEventDispatcher.h>
#import "BrazeReactUtils.h"
#import "BrazeReactBridge.h"

#import <BrazeKit/BrazeKit-Swift.h>
#import <AppsFlyerLib/AppsFlyerLib.h>

...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

...
  RCTAppSetupPrepareApp(application);

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];

  NSDictionary *initProps = [self prepareInitialProps];
  UIView *rootView = RCTAppSetupDefaultRootView(bridge,@"MyApp", initProps);

  if (@available(iOS 13.0, *)) {
    rootView.backgroundColor = [UIColor systemBackgroundColor];
  } else {
    rootView.backgroundColor = [UIColor whiteColor];
  }

  [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView];

  // Configure views in the application
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

...

return YES;
}

...

- (NSDictionary *)prepareInitialProps
{
  NSMutableDictionary *initProps = [NSMutableDictionary new];

#ifdef RCT_NEW_ARCH_ENABLED
  initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
#endif

  return initProps;
}

...

- (void)application:(UIApplication *)application
  didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken: %@", deviceToken);
  [[AppsFlyerLib shared] registerUninstall:deviceToken];
}

Version 0.71:

AppDelegate.mm

#import "AppDelegate.h"
#import "RNCConfig.h"
#import "Orientation.h"

#import <React/RCTBundleURLProvider.h>
#import <Firebase.h>
#import <RNGoogleSignin/RNGoogleSignin.h>
#import <CodePush/CodePush.h>
#import <AuthenticationServices/AuthenticationServices.h>
#import <SafariServices/SafariServices.h>
#import <FBSDKCoreKit/FBSDKCoreKit-Swift.h>
#import <React/RCTLinkingManager.h>
#import <React/RCTEventDispatcher.h>
#import "BrazeReactUtils.h"
#import "BrazeReactBridge.h"

#import <BrazeKit/BrazeKit-Swift.h>
#import <AppsFlyerLib/AppsFlyerLib.h>

...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

...

 self.moduleName = @"MyApp";
 self.initialProps = @{};

...

 return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

...

- (void)application:(UIApplication *)application
  didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken: %@", deviceToken);
  [[AppsFlyerLib shared] registerUninstall:deviceToken];
}

package.json

{
  "dependencies": {
...
    "obfuscator-io-metro-plugin": "^2.1.1",
-   "react": "18.1.0",
+   "react": "18.2.0",
    "react-async-hook": "^4.0.0",
    "react-i18next": "^14.0.5",
-   "react-native": "0.70.15",
+   "react-native": "0.71.18",
    "react-native-alert-utils": "^1.0.1",
    "react-native-animatable": "^1.3.3",
    "react-native-appsflyer": "^6.14.3",
    "react-native-audio-recorder-player": "^3.2.0",
    "react-native-autocomplete-input": "^5.4.0",
  ...
  }
 "devDependencies": {
-   "@babel/core": "^7.12.9",
+   "@babel/core": "^7.20.0",
+   "@babel/preset-env": "^7.20.0",
-   "@babel/runtime": "^7.12.5",
+   "@babel/runtime": "^7.20.0",
    "@react-native-community/eslint-config": "^3.2.0",
+   "@tsconfig/react-native": "^2.0.2",
+   "babel-jest": "^29.2.1",
    "@testing-library/jest-native": "^5.4.2",
    "@testing-library/react-hooks": "^8.0.1",
    "@testing-library/react-native": "^12.0.1",
    "@types/async-retry": "^1.4.2",
    "@types/color": "^3.0.1",
    "@types/country-data": "^0.0.2",
    "@types/flat": "^5.0.1",
    "@types/format-duration": "^1.0.1",
    "@types/hoist-non-react-statics": "^3.3.1",
-   "@types/jest": "^29.0.3",
+   "@types/jest": "^29.2.1",
    "@types/lodash": "^4.14.149",
    "@types/mime": "^3.0.1",
-   "@types/react": "^18.0.1",
+   "@types/react": "^18.0.24",
    "@types/react-native": "^0.70.15",
    "@types/react-native-autocomplete-input": "^4.0.1",
    "@types/react-native-share": "^3.3.3",
    "@types/react-native-snap-carousel": "^3.8.1",
    "@types/react-native-svg-charts": "^5.0.5",
    "@types/react-native-vector-icons": "^6.4.14",
    "@types/react-native-video": "^5.0.10",
    "@types/react-redux": "^7.1.7",
-   "@types/react-test-renderer": "^16.9.1",
+   "@types/react-test-renderer": "^18.0.0",
    "@types/recompose": "^0.30.7",
    "@types/suncalc": "^1.8.0",
    "@types/url-parse": "^1.4.6",
    "@types/yup": "^0.26.36",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "babel-plugin-module-resolver": "^5.0.0",
    "core-js": "^3.30.1",
    "eslint": "^8.19.0",
    "eslint-config-prettier": "^8.8.0",
    "eslint-import-resolver-babel-module": "^5.3.2",
    "eslint-plugin-import": "^2.27.5",
    "eslint-plugin-jsx-a11y": "^6.7.1",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-native": "^4.0.0",
-   "jest": "^29.0.0",
-   "metro-react-native-babel-preset": "^0.72.4",
+   "jest": "^29.2.1",
+   "metro-react-native-babel-preset": "^0.73.10",
    "msw": "^1.2.1",
    "patch-package": "^6.4.7",
-   "prettier": "^2.8.8",
-   "react-test-renderer": "18.1.0",
+   "prettier": "^2.4.1",
+   "react-test-renderer": "18.2.0",
    "run-script-os": "^1.1.6",
    "ts-jest": "^29.0.5",
-   "typescript": "^4.3.0"
+   "typescript": "^4.8.4"
    }
}
github-actions[bot] commented 1 month ago

👋 Hi @danielreisSL and Thank you for reaching out to us. In order for us to provide optimal support, please submit a ticket to our support team at support@appsflyer.com. When submitting the ticket, please specify: