admin管理员组文章数量:1122846
I have updated my project from 0.68 to 0.70.0 since than i have started facing issues with iOS as soon as my app builds completed my iOS app got stuck on splash screen with this error
1.Updated app from 68 ==> 70
2.Did configurations changes according --> /?from=0.68.0&to=0.70.0&package=com.singlife.mobile&name=Singlife
3.Did npx react-native-clean-project
4.Did yarn pod
5.Build iOS app and it got stuck with following error
Invariant Violation: new NativeEventEmitter() requires a non-null argument.
Invariant Violation: Failed to call into JavaScript module method 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 cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
Running perfectly fine for Android
My Package.json
{
"name": "mobile",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"ios": "react-native run-ios",
"android": "react-native run-android",
"test": "jest --config jest.config.json --update-snapshot",
"test-ci": "jest --config jest.config.json --ci",
"coverage": "jest --config jest.config.json --collect-coverage",
"lint": "eslint -c .eslintrc.js --ext .ts --ext .tsx src",
"pod": "cd ios/ && pod install && cd ..",
"clean": "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 remember to check whether the post install \n* patches in node_module_patches are still relevant \n* after every app node_module upgrade.\n* \n***************************************************************\n' && cp -vRf node_modules_patches/* node_modules"
},
"rnpm": {
"assets": [
"./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",
"moment": "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+.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",
"@types/d3-scale": "^3.3.0",
"@types/d3-shape": "^2.1.0",
"@types/enzyme": "3.10.8",
"@types/enzyme-adapter-react-16": "1.0.6",
"@types/jest": "24.9.1",
"@types/react": "16.9.55",
"@types/react-native": "0.60.31",
"@types/react-native-share": "^3.3.3",
"@types/react-native-vector-icons": "6.4.6",
"@types/react-native-video": "5.0.3",
"@types/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 <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <Firebase.h>
#import "RNBootSplash.h"
#import <RNBranch/RNBranch.h>
#import <TrustKit/TrustKit.h>
#import <TrustKit/TSKPinningValidator.h>
#import <TrustKit/TSKPinningValidatorCallback.h>
#import <ACPAnalytics.h>
#import "ACPCore.h"
#import "ACPUserProfile.h"
#import "ACPIdentity.h"
#import "ACPLifecycle.h"
#import "ACPSignal.h"
#import "AEPAssurance.h"
#import <React/RCTAppSetupUtils.h>
#if RCT_NEW_ARCH_ENABLED
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/config/ReactNativeConfig.h>
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
RCTTurboModuleManager *_turboModuleManager;
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
facebook::react::ContextContainer::Shared _contextContainer;
}
@end
#endif
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
RCTAppSetupPrepareApp(application);
// Override TrustKit's logger method, useful for local debugging
void (^loggerBlock)(NSString *) = ^void(NSString *message)
{
NSLog(@"TrustKit log: %@", message);
};
[TrustKit setLoggerBlock:loggerBlock];
NSDictionary *trustKitConfig =
@{
// Swizzling because we can't access the NSURLSession instance used in React Native's fetch method
kTSKSwizzleNetworkDelegates: @YES,
kTSKPinnedDomains: @{
@"saber.singlife" : @{
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" : @{
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" : @{
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 *result, NSString *notedHostname, TKSDomainPinningPolicy *policy) {
if (result.finalTrustDecision == TSKTrustEvaluationFailedNoMatchingPin) {
NSLog(@"TrustKit certificate matching failed");
// Add more logging here. i.e. Sentry, BugSnag etc
}
};
// Firebase init
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
// Branch 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<facebook::react::ContextContainer const>();
_reactNativeConfig = std::make_shared<facebook::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, @"mobile", initProps);
if (@available(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:@"<ADOBE_APP_ID>"];
[ACPUserProfile registerExtension];
[ACPIdentity registerExtension];
[ACPLifecycle registerExtension];
[ACPSignal registerExtension];
[AEPAssurance registerExtension];
const UIApplicationState appState = application.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 method controls whether the `concurrentRoot`feature of React18 is turned on or off.
///
/// @see: .html
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`.
- (BOOL)concurrentRootEnabled
{
// Switch this bool to turn on 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)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
if ([RNBranch application:app openURL:url options:options]) {
// do other deep link routing for the Facebook SDK, Pinterest SDK, etc
}
return YES;
}
- (BOOL)application:(UIApplication *)application 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:@"main" withExtension:@"jsbundle"];
#endif
}
#if RCT_NEW_ARCH_ENABLED
#pragma mark - RCTCxxBridgeDelegate
- (std::unique_ptr<facebook::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 *)name
{
return RCTCoreModulesClassProvider(name);
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
{
return nullptr;
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
initParams:
(const facebook::react::ObjCTurboModule::InitParams &)params
{
return nullptr;
}
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
{
return RCTAppSetupDefaultModuleFromClass(moduleClass);
}
#endif
@end
Output of npx react-native info
System:
OS: macOS 14.7.1
CPU: (10) arm64 Apple M2 Pro
Memory: 58.19 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.13.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.1 - /usr/local/bin/npm
Watchman: 2024.07.29.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /opt/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 Found
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 Found
react: 18.1.0 => 18.1.0
react-native: 0.70.0 => 0.70.0
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
本文标签: iosErrorInvariant Violation new NativeEventEmitter() requires a nonnull argumentStack Overflow
版权声明:本文标题:ios - Error - Invariant Violation new NativeEventEmitter() requires a non-null argument - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736304722a1932332.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论