14.8 C
New York
Wednesday, December 11, 2024

ios – Error – Invariant Violation new NativeEventEmitter() requires a non-null argument


I’ve up to date my venture from 0.68 to 0.70.0 since than i’ve began going through points with iOS as quickly as my app builds accomplished my iOS app received caught on splash display screen with this error

1.Up to date app from 68 ==> 70

2.Did configurations adjustments in accordance –> https://react-native-community.github.io/upgrade-helper/?from=0.68.0&to=0.70.0&bundle=com.singlife.cellular&title=Singlife

3.Did npx react-native-clean-project

4.Did yarn pod

5.Construct iOS app and it received caught with following error

Invariant Violation: new NativeEventEmitter() requires a non-null argument.

Invariant Violation: Did not name into JavaScript module methodology AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
A frequent explanation for the error is that the appliance entry file path is inaccurate. This could additionally occur when the JS bundle is corrupt or there's an early initialization error when loading React Native.

Operating completely nice for Android

My Package deal.json

 {
  "title": "cellular",
  "model": "0.0.1",
  "non-public": true,
  "scripts": {
    "begin": "react-native begin",
    "ios": "react-native run-ios",
    "android": "react-native run-android",
    "check": "jest --config jest.config.json --update-snapshot",
    "test-ci": "jest --config jest.config.json --ci",
    "protection": "jest --config jest.config.json --collect-coverage",
    "lint": "eslint -c .eslintrc.js --ext .ts --ext .tsx src",
    "pod": "cd ios/ && pod set up && cd ..",
    "clear": "watchman watch-del-all && rm -rf package-lock.json && rm -rf node_modules && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-map-* && yarn",
    "postinstall": "printf '***************************************************************n*n*                Singlife - ATTENTION!       n*n*     Please bear in mind to verify whether or not the submit set up n*     patches in node_module_patches are nonetheless related n*          after each app node_module improve.n* n***************************************************************n' && cp -vRf node_modules_patches/* node_modules"
  },
  "rnpm": {
    "belongings": [
      "./assetc/fonts"
    ]
  },
  "pre-commit": [
    "lint"
  ],
  "resolutions": {
    "d3-array": "2.3.3"
  },
  "dependencies": {
    "@adobe/react-native-acpanalytics": "^2.0.0",
    "@adobe/react-native-acpcore": "^2.0.0",
    "@adobe/react-native-aepassurance": "2.0.0",
    "@expo/react-native-action-sheet": "^4.0.1",
    "@notifee/react-native": "7.2.0",
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/cameraroll": "^4.1.2",
    "@react-native-community/clipboard": "1.5.1",
    "@react-native-community/datetimepicker": "3.0.4",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "^11.3.1",
    "@react-native-community/progress-bar-android": "1.0.4",
    "@react-native-community/progress-view": "1.2.3",
    "@react-native-community/slider": "3.0.3",
    "@react-native-cookies/cookies": "^6.2.1",
    "@react-native-firebase/analytics": "^15.2.0",
    "@react-native-firebase/app": "^15.2.0",
    "@react-native-firebase/crashlytics": "^15.2.0",
    "@react-native-firebase/in-app-messaging": "^15.2.0",
    "@react-native-firebase/messaging": "^15.2.0",
    "@react-native-firebase/remote-config": "^15.2.0",
    "@react-native-picker/picker": "2.4.8",
    "@react-navigation/bottom-tabs": "^6.6.0",
    "@react-navigation/core": "^6.4.10",
    "@react-navigation/drawer": "6.6.1",
    "@react-navigation/material-top-tabs": "^6.6.14",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/native-stack": "^6.10.0",
    "@react-navigation/stack": "^6.4.0",
    "@sentry/react-native": "5.32.0",
    "axios": "0.24.0",
    "base-64": "1.0.0",
    "d3-scale": "3.3.0",
    "d3-shape": "2.1.0",
    "deprecated-react-native-prop-types": "^5.0.0",
    "fbjs": "3.0.4",
    "jail-monkey": "2.6.0",
    "jwt-decode": "3.1.2",
    "libphonenumber-js": "1.7.38",
    "lottie-ios": "3.2.3",
    "lottie-react-native": "4.1.3",
    "second": "2.29.1",
    "postinstall-postinstall": "^2.1.0",
    "react": "18.1.0",
    "react-native": "0.70.0",
    "react-native-aes-crypto": "^2.1.0",
    "react-native-background-timer": "^2.4.1",
    "react-native-biometrics": "2.1.4",
    "react-native-bootsplash": "^3.0.0-rc.0",
    "react-native-branch": "6.2.2",
    "react-native-bundle-splitter": "^2.2.3",
    "react-native-camera": "3.40.0",
    "react-native-circular-progress-indicator": "^4.4.2",
    "react-native-device-info": "7.0.2",
    "react-native-dh-keys": "^2.0.2",
    "react-native-document-picker": "^3.2.4",
    "react-native-fast-rsa": "2.3.6",
    "react-native-file-viewer": "^2.1.5",
    "react-native-geolocation-service": "^5.3.1",
    "react-native-gesture-handler": "2.10.0",
    "react-native-image-crop-picker": "^0.41.2",
    "react-native-inappbrowser": "git+https://github.com/proyecto26/react-native-inappbrowser.git#develop",
    "react-native-insider": "6.4.4",
    "react-native-keyboard-accessory": "^0.1.16",
    "react-native-keychain": "^7.0.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-markdown-renderer": "^3.2.8",
    "react-native-modal": "^11.5.6",
    "react-native-month-year-picker": "^1.9.0",
    "react-native-pager-view": "5.4.9",
    "react-native-pdf": "6.2.2",
    "react-native-permissions": "^3.8.4",
    "react-native-qualtrics": "2.3.0",
    "react-native-reanimated": "3.2.0",
    "react-native-redash": "^5.0.0",
    "react-native-safe-area-context": "3.4.0",
    "react-native-screens": "3.26.0",
    "react-native-share": "^7.9.0",
    "react-native-shared-element": "0.8.4",
    "react-native-svg": "12.2.0",
    "react-native-svg-transformer": "0.14.3",
    "react-native-tab-view": "3.2.0",
    "react-native-text-ticker": "^1.14.0",
    "react-native-tracking-transparency": "^0.1.1",
    "react-native-vector-icons": "^10.1.0",
    "react-native-video": "^5.2.1",
    "react-native-view-shot": "^3.3.0",
    "react-native-walkme-sdk": "^2.2.9",
    "react-native-webview": "11.23.0",
    "react-navigation-shared-element": "3.1.3",
    "react-redux": "7.2.2",
    "redux": "4.0.5",
    "redux-persist": "6.0.0",
    "redux-persist-transform-encrypt": "^3.0.1",
    "redux-saga": "1.1.1",
    "rn-fetch-blob": "0.12.0",
    "rn-qr-generator": "^1.2.1",
    "svg-path-properties": "^1.0.11",
    "victory-native": "^33.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.22.10",
    "@babel/preset-typescript": "^7.22.5",
    "@babel/runtime": "^7.12.5",
    "@redux-saga/testing-utils": "1.1.3",
    "@testing-library/react-native": "6.0.0",
    "@varieties/d3-scale": "^3.3.0",
    "@varieties/d3-shape": "^2.1.0",
    "@varieties/enzyme": "3.10.8",
    "@varieties/enzyme-adapter-react-16": "1.0.6",
    "@varieties/jest": "24.9.1",
    "@varieties/react": "16.9.55",
    "@varieties/react-native": "0.60.31",
    "@varieties/react-native-share": "^3.3.3",
    "@varieties/react-native-vector-icons": "6.4.6",
    "@varieties/react-native-video": "5.0.3",
    "@varieties/react-redux": "7.1.10",
    "@typescript-eslint/eslint-plugin": "^5.39.0",
    "@typescript-eslint/parser": "^5.38.1",
    "babel-jest": "^26.6.3",
    "babel-plugin-module-resolver": "^3.2.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "enzyme": "3.11.0",
    "enzyme-adapter-react-16": "1.15.5",
    "eslint": "^7.32.0",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-react-hooks": "4.6.0",
    "jest": "^26.6.3",
    "jest-fetch-mock": "2.1.2",
    "metro-react-native-babel-preset": "^0.72.1",
    "pre-commit": "^1.2.2",
    "react-dom": "^16.8.6",
    "react-native-codegen": "^0.0.7",
    "react-native-obfuscating-transformer": "^1.0.0",
    "react-native-typescript-transformer": "1.2.13",
    "react-test-renderer": "18.1.0",
    "redux-devtools-extension": "2.13.8",
    "redux-mock-store": "1.5.4",
    "ts-jest": "24.3.0",
    "typescript": "4.8.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

My Appdelegate.mm

#import "AppDelegate.h"
 
#import 
#import 
#import 
 
#import 
#import "RNBootSplash.h"
#import 
 
#import 
#import 
#import 
 
#import 
#import "ACPCore.h"
#import "ACPUserProfile.h"
#import "ACPIdentity.h"
#import "ACPLifecycle.h"
#import "ACPSignal.h"
#import "AEPAssurance.h"
 
#import 
 
#if RCT_NEW_ARCH_ENABLED
#import 
#import 
#import 
#import 
#import 
#import 
 
#import 
 
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
 
@interface AppDelegate ()  {
  RCTTurboModuleManager *_turboModuleManager;
  RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
  std::shared_ptr _reactNativeConfig;
  fb::react::ContextContainer::Shared _contextContainer;
}
@finish
#endif
 
@implementation AppDelegate
 
- (BOOL)utility:(UIApplication *)utility didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
 
  RCTAppSetupPrepareApp(utility);
 
  // Override TrustKit's logger methodology, helpful for native debugging
  void (^loggerBlock)(NSString *) = ^void(NSString *message)
  {
    NSLog(@"TrustKit log: %@", message);
  };
  [TrustKit setLoggerBlock:loggerBlock];
 
  NSDictionary *trustKitConfig =
  @{
    // Swizzling as a result of we won't entry the NSURLSession occasion utilized in React Native's fetch methodology
    kTSKSwizzleNetworkDelegates: @YES,
    kTSKPinnedDomains: @{
        @"saber.singlife.com" : @{
            kTSKIncludeSubdomains: @NO, // Pin all subdomains
            kTSKEnforcePinning: @YES, // Block connections if pinning validation failed
            kTSKDisableDefaultReportUri: @YES,
            kTSKPublicKeyHashes : @[
              @"**********************************************", // Renewed on 14 NOV 2022 - PROD, Expiring on 13 NOV 2023
              @"**********************************************", // Renewed on 24 OCT 2023 - PROD, Expiring on 23 OCT 2024
              @"**********************************************", // Akamai Certi Added on 27 May 2024 - PROD, Expiring on 7 FEB 2025
            ],
        },
        @"uat.saber.singlife.com" : @{
            kTSKIncludeSubdomains: @NO, // Pin all subdomains
            kTSKEnforcePinning: @YES, // Block connections if pinning validation failed
            kTSKDisableDefaultReportUri: @YES,
            kTSKPublicKeyHashes : @[
              @"**********************************************", // Renewed on 24 OCT 2023 - UAT, Expiring on 23 OCT 2024
              @"**********************************************", // Renewed on 24 OCT 2023 - STAG, Expiring on 23 OCT 2024
              @"**********************************************", // Akamai Certi Added on 23 May 2024 - PROD, Expiring on 13 AUG 2024
              @"**********************************************", // UAT cert added
              @"**********************************************", // UAT cert added Nov 2024
            ],
        },
        @"staging.saber.singlife.com" : @{
            kTSKIncludeSubdomains: @NO, // Pin all subdomains
            kTSKEnforcePinning: @YES, // Block connections if pinning validation failed
            kTSKDisableDefaultReportUri: @YES,
            kTSKPublicKeyHashes : @[
              @"**********************************************", // Renewed on 24 OCT 2023 - UAT, Expiring on 23 OCT 2024
              @"**********************************************", // Renewed on 24 OCT 2023 - STAG, Expiring on 23 OCT 2024
              @"**********************************************", // Renewed due to server movement to Akamai on 23 May 2024
              @"**********************************************", // UAT cert added
              @"**********************************************", // UAT cert added Nov 2024
            ],
        },
    }};
  [TrustKit initSharedInstanceWithConfiguration:trustKitConfig];
  [TrustKit sharedInstance].pinningValidatorCallback = ^(TSKPinningValidatorResult *end result, NSString *notedHostname, TKSDomainPinningPolicy *coverage) {
    if (end result.finalTrustDecision == TSKTrustEvaluationFailedNoMatchingPin) {
      NSLog(@"TrustKit certificates matching failed");
      // Add extra logging right here. i.e. Sentry, BugSnag and so forth
    }
  };
 
  // Firebase init
  if ([FIRApp defaultApp] == nil) {
    [FIRApp configure];
  }
 
  // Department init
  [RNBranch useTestInstance];
  [RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
 
  UNUserNotificationCenter.currentNotificationCenter.delegate = self;
 
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
 
  #if RCT_NEW_ARCH_ENABLED
  _contextContainer = std::make_shared<:react::contextcontainer const="">();
  _reactNativeConfig = std::make_shared<:react::emptyreactnativeconfig const="">();
  _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
  _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
  bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
  #endif
 
  NSDictionary *initProps = [self prepareInitialProps];
  UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"cellular", initProps);
 
  if (@accessible(iOS 13.0, *)) {
      rootView.backgroundColor = [UIColor systemBackgroundColor];
  } else {
      rootView.backgroundColor = [UIColor whiteColor];
  }
 
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
 
  // Adobe init
  [ACPAnalytics registerExtension];
  [ACPCore setLogLevel:ACPMobileLogLevelDebug];
  [ACPCore configureWithAppId:@""];
  [ACPUserProfile registerExtension];
  [ACPIdentity registerExtension];
  [ACPLifecycle registerExtension];
  [ACPSignal registerExtension];
  [AEPAssurance registerExtension];
 
  const UIApplicationState appState = utility.applicationState;
  [ACPCore start:^{
    // only start lifecycle if the application is not in the background
    if (appState != UIApplicationStateBackground) {
      [ACPCore lifecycleStart:nil];
    }
  }];

  [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView];
 
  return YES;
}
 
  /// This methodology controls whether or not the `concurrentRoot`characteristic of React18 is turned on or off.
  ///
  /// @see: https://reactjs.org/weblog/2022/03/29/react-v18.html
  /// @observe: This requires to be rendering on Cloth (i.e. on the New Structure).
  /// @return: `true` if the `concurrentRoot` feture is enabled. In any other case, it returns `false`.
  - (BOOL)concurrentRootEnabled
  {
    // Change this bool to activate and off the concurrent root
    return true;
  }
  
  - (NSDictionary *)prepareInitialProps
  {
    NSMutableDictionary *initProps = [NSMutableDictionary new];
  
  #ifdef RCT_NEW_ARCH_ENABLED
    initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
  #endif
  
    return initProps;
  }
 
- (BOOL)utility:(UIApplication *)app openURL:(NSURL *)url choices:(NSDictionary *)choices {
    if ([RNBranch application:app openURL:url options:options])  {
        // do different deep hyperlink routing for the Fb SDK, Pinterest SDK, and so forth
    }
    return YES;
}
 
- (BOOL)utility:(UIApplication *)utility continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
    return [RNBranch continueUserActivity:userActivity];
}
 
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
  return [[NSBundle mainBundle] URLForResource:@"important" withExtension:@"jsbundle"];
#endif
}
 
#if RCT_NEW_ARCH_ENABLED
 
#pragma mark - RCTCxxBridgeDelegate
 
- (std::unique_ptr<:react::jsexecutorfactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
{
  _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
                                                             delegate:self
                                                            jsInvoker:bridge.jsCallInvoker];
  return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
}
 
#pragma mark RCTTurboModuleManagerDelegate
 
- (Class)getModuleClassFromName:(const char *)title
{
  return RCTCoreModulesClassProvider(title);
}
 
- (std::shared_ptr<:react::turbomodule>)getTurboModule:(const std::string &)title
                                                      jsInvoker:(std::shared_ptr<:react::callinvoker>)jsInvoker
{
  return nullptr;
}
 
- (std::shared_ptr<:react::turbomodule>)getTurboModule:(const std::string &)title
                                                     initParams:
                                                         (const fb::react::ObjCTurboModule::InitParams &)params
{
  return nullptr;
}
 
- (id)getModuleInstanceFromClass:(Class)moduleClass
{
  return RCTAppSetupDefaultModuleFromClass(moduleClass);
}
 
#endif
 
 
@finish

Output of npx react-native information

System:
    OS: macOS 14.7.1
    CPU: (10) arm64 Apple M2 Professional
    Reminiscence: 58.19 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.13.1 - /usr/native/bin/node
    Yarn: 1.22.19 - /usr/native/bin/yarn
    npm: 10.8.1 - /usr/native/bin/npm
    Watchman: 2024.07.29.00 - /choose/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.15.2 - /choose/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 24.1, iOS 18.1, macOS 15.1, tvOS 18.1, visionOS 2.1, watchOS 11.1
    Android SDK: Not Discovered
  IDEs:
    Android Studio: 2024.1 AI-241.18034.62.2411.12169540
    Xcode: 16.1/16B40 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.23 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Discovered
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.0 => 0.70.0 
    react-native-macos: Not Discovered
  npmGlobalPackages:
    *react-native*: Not Discovered

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles