react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[iOS] libc++abi: terminating with uncaught exception of type std::runtime_error: Feature flags were accessed before being overridden: fuseboxEnabledRelease

Open benjamin-beau opened this issue 1 year ago • 1 comments

Description

After upgrading RN from 74.1 to 76.0 I get the following error when launching the app in debug from Xcode :

libc++abi: terminating with uncaught exception of type std::runtime_error: Feature flags were accessed before being overridden: fuseboxEnabledRelease

The app works fine on Android. I tried to launch a template app (npx @react-native-community/cli@latest init Test) and it starts just fine. So I think it is a config issue on my side. My problem is that I don't know where to start in order to debug on this type of deep issue (c++ error). Since it is a config issue it is really complicated for me to setup a reproducer, I striped down my project to keep the bare minimum and provided the link to this.

My question is : if this error is not known, how to debug this type of error ?

Steps to reproduce

  1. Upgrade app from from 74.1 to 76.0.
  2. Compile and start from XCode.
  3. App crashes at startup.

React Native Version

0.76.0

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 15.0.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 268.17 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.1.0
    path: ~/.nvm/versions/node/v21.1.0/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.2.0
    path: ~/.nvm/versions/node/v21.1.0/bin/npm
  Watchman:
    version: 2024.09.23.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/benjaminbeau/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12483815
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.20.1
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/benjaminbeau/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 14.1.1
    wanted: ^14.1.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.0
    wanted: 0.76.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: false
  newArchEnabled: true

Stacktrace or Logs

2024-10-24 11:50:24.310785+0200 surloMobile[53882:2265559] [Mapbox] [Info, common]: Using Mapbox Common SDK v24.5.0(edbe9cbfd)
2024-10-24 11:50:24.315740+0200 surloMobile[53882:2265559] [Mapbox] [Info, maps-core]: Using Mapbox Core Maps SDK v11.5.0(e548448702)
2024-10-24 11:50:24.366175+0200 surloMobile[53882:2265559] [TSBackgroundFetch load]: (
)
2024-10-24 11:50:24.366718+0200 surloMobile[53882:2265559] [TSBGAppRefreshSubscriber load]: {
}
2024-10-24 11:50:24.405722+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Looking up debug dylib relative path
2024-10-24 11:50:24.410527+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Found debug dylib relative path string `surloMobile.debug.dylib`
2024-10-24 11:50:24.410544+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Looking up debug dylib entry point name
2024-10-24 11:50:24.410552+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] No debug dylib entry point name defined.
2024-10-24 11:50:24.410557+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Looking up debug dylib install name
2024-10-24 11:50:24.410565+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Found debug dylib install name string `@rpath/surloMobile.debug.dylib`
2024-10-24 11:50:24.410573+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Looking for Previews JIT link entry point.
2024-10-24 11:50:24.474952+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] No Previews JIT entry point found.
2024-10-24 11:50:24.474990+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Gave PreviewsInjection a chance to run and it returned, continuing with debug dylib.
2024-10-24 11:50:24.474998+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Looking for main entry point.
2024-10-24 11:50:24.475008+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Opening debug dylib with '@rpath/surloMobile.debug.dylib'
2024-10-24 11:50:24.475049+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Debug dylib handle: 0x200d5d4c0
2024-10-24 11:50:24.475060+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] No entry point found. Checking for alias.
2024-10-24 11:50:24.475072+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Calling provided entry point.
2024-10-24 11:50:24.685208+0200 surloMobile[53882:2265841] [[FirebaseMessaging]] 11.4.0 - [FirebaseMessaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2024-10-24 11:50:24.829490+0200 surloMobile[53882:2265843] [connection] nw_socket_handle_socket_event [C1.1:2] Socket SO_ERROR [61: Connection refused]
2024-10-24 11:50:24.831571+0200 surloMobile[53882:2265843] [connection] nw_socket_handle_socket_event [C1.2:2] Socket SO_ERROR [61: Connection refused]
2024-10-24 11:50:24.832102+0200 surloMobile[53882:2265843] Connection 1: received failure notification
2024-10-24 11:50:24.832246+0200 surloMobile[53882:2265843] Connection 1: failed to connect 1:61, reason -1
2024-10-24 11:50:24.832280+0200 surloMobile[53882:2265843] Connection 1: encountered error(1:61)
2024-10-24 11:50:24.833721+0200 surloMobile[53882:2265843] Task <8A0B759E-48AB-4B06-A42D-5B1D65AC6FB1>.<1> HTTP load failed, 0/0 bytes (error code: -1004 [1:61])
2024-10-24 11:50:24.841309+0200 surloMobile[53882:2265842] Task <8A0B759E-48AB-4B06-A42D-5B1D65AC6FB1>.<1> finished with error [-1004] Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x2814747b0 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: lo0, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <8A0B759E-48AB-4B06-A42D-5B1D65AC6FB1>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <8A0B759E-48AB-4B06-A42D-5B1D65AC6FB1>.<1>"
), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=http://localhost:8081/status, NSErrorFailingURLKey=http://localhost:8081/status, _kCFStreamErrorDomainKey=1}
2024-10-24 11:50:24.858759+0200 surloMobile[53882:2265559] [HealthKit] Background observers added to the app
libc++abi: terminating with uncaught exception of type std::runtime_error: Feature flags were accessed before being overridden: fuseboxEnabledRelease

Reproducer

https://github.com/benjamin-beau/RN_crash

Screenshots and Videos

No response

benjamin-beau avatar Oct 25 '24 10:10 benjamin-beau

Hi @benjamin-beau, thanks for the issue. I was trying to download the repro but I'm getting a 401 when trying to install MapboxCommon... 🤷

Anyway, I had a look at the code and there are a couple of things that stand out:

  • In the AppDelegate.mm file, you are initializing a bunch of stuff before calling [super application:application didFinishLaunchingWithOptions:launchOptions]. Calling [super should be one of the first things you do, as it bootstrap React Native.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
+  self.moduleName = @"surloMobile";
+  // You can add your custom initial props in the dictionary below.
+  // They will be passed down to the ViewController used by React Native.
+  self.initialProps = @{};

+  BOOL appLaunched = [super application:application didFinishLaunchingWithOptions:launchOptions];
+  if (!appLaunched) {
+    return NO;
+  }

  [FIRApp configure];

  // [REQUIRED] Register BackgroundFetch
  [[TSBackgroundFetch sharedInstance] didFinishLaunching];
  
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self
                                            launchOptions:launchOptions];
  /* Add Background initializer for HealthKit  */
  [[RCTAppleHealthKit new] initializeBackgroundObservers:bridge];

-  self.moduleName = @"surloMobile";
-  // You can add your custom initial props in the dictionary below.
-  // They will be passed down to the ViewController used by React Native.
-  self.initialProps = @{};

-  return [super application:application didFinishLaunchingWithOptions:launchOptions];
  return appLaunched;
}
  • The second problem is that you are initializing the Bridge for the RCTAppleHealthKit library. With 0.76, the new architecture is enabled by default and the Bridge is basically unused. Especially, you are creating a new instance not connected with the React Native runtime. I believe that that line needs to be adjusted. The right way to do is to request the bridge property from the super class, as we are initializing it with a proxy bridge from the interop layer, so it might work.
// This is a workaround because the library should not request the bridge when it is initialized.
+ #import <React/RCTBridge+Private.h>
// ...
-  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self
-                                            launchOptions:launchOptions];
-  /* Add Background initializer for HealthKit  */
- [[RCTAppleHealthKit new] initializeBackgroundObservers:bridge];
+ [[RCTAppleHealthKit new] initializeBackgroundObservers:[RCTBridge currentBridge]];

Can you share the github repo of that library? That probably need to properly migrate to the New Architecture if it does not work in this way.

Hope that this helps unblock you.

cipolleschi avatar Oct 26 '24 00:10 cipolleschi

I have same problem. I have upgraded from 0.74.0 to 0.76.0 and i have double checked everything from Upgrade helper, i have reinstalled pods, cleaned project with react-native-clean-project. When i tried to install clean project it worked. Same thing happens using terminal command and Xcode. Using terminal app just crushes on start. When running through Xcode this is appearing on simulator: No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle.

unsanitizedScriptURLString = (null)

I am using Xcode 16.1 and corresponding Command Line Tools 16.1. Tried to upgrade Cocoapods to 1.16.0 but no luck since i use M3 silicon from Apple.

This is the whole output in Xcode:

` warning: (arm64) /Users/duperx/Library/Developer/Xcode/DerivedData/Baba-bmujiqaggjqaasheqevjjclcoxbp/Build/Products/Debug-iphonesimulator/Baba.app/Baba empty dSYM file detected, dSYM was created with an executable with no debug info. nw_socket_handle_socket_event [C1.1.1:2] Socket SO_ERROR [61: Connection refused] nw_endpoint_flow_failed_with_error [C1.1.1 ::1.8081 in_progress socket-flow (satisfied (Path is satisfied), interface: lo0)] already failing, returning nw_socket_handle_socket_event [C1.1.2:2] Socket SO_ERROR [61: Connection refused] nw_endpoint_flow_failed_with_error [C1.1.2 127.0.0.1:8081 in_progress socket-flow (satisfied (Path is satisfied), interface: lo0)] already failing, returning nw_endpoint_flow_failed_with_error [C1.1.2 127.0.0.1:8081 cancelled socket-flow ((null))] already failing, returning Connection 1: received failure notification Connection 1: failed to connect 1:61, reason -1 Connection 1: encountered error(1:61) Task <CBC3081C-B61B-4A4E-A24D-CC56C73A1ED0>.<1> HTTP load failed, 0/0 bytes (error code: -1004 [1:61]) Task <CBC3081C-B61B-4A4E-A24D-CC56C73A1ED0>.<1> finished with error [-1004] Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x600000c72ca0 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: utun8[802.11], uses wifi, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <CBC3081C-B61B-4A4E-A24D-CC56C73A1ED0>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <CBC3081C-B61B-4A4E-A24D-CC56C73A1ED0>.<1>" ), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=http://localhost:8081/status, NSErrorFailingURLKey=http://localhost:8081/status, _kCFStreamErrorDomainKey=1} WARNING: Logging before InitGoogleLogging() is written to STDERR W1029 12:06:36.080183 43647488 Scheduler.cpp:158] Scheduler::~Scheduler() was called (address: 0x60000370cf00). No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle.

unsanitizedScriptURLString = (null) W1029 12:06:36.149204 1844424704 UIManagerBinding.cpp:61] UIManagerBinding::~UIManagerBinding() was called (address: 0x600003b08c58). W1029 12:06:36.149271 1844424704 UIManager.cpp:64] UIManager::~UIManager() was called (address: 0x103812d38). `

hellogbg avatar Oct 29 '24 11:10 hellogbg

@benjamin-beau did you solve your issue?

cipolleschi avatar Oct 31 '24 15:10 cipolleschi

Hello There,

Any workaround for this?

Thanks in advance

FaggioniHQ avatar Nov 16 '24 15:11 FaggioniHQ

@FaggioniHQ what's your use case? Can you see if these suggestions help you?

What's happening is a misconfiguration on the App side, not on React Native: the app is trying to access the React Native runtime before it is actually initialized. I suggest you to look into your AppDelegate and into the - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method

cipolleschi avatar Nov 21 '24 16:11 cipolleschi

Hey @cipolleschi

Thanks for your reply... i solved the issue some days ago by changing some old code on the AppDelegate. Indeed was related to the didFinishLaunchingWithOptions method

FaggioniHQ avatar Nov 21 '24 19:11 FaggioniHQ

Description

After upgrading RN from 74.1 to 76.0 I get the following error when launching the app in debug from Xcode :

libc++abi: terminating with uncaught exception of type std::runtime_error: Feature flags were accessed before being overridden: fuseboxEnabledRelease

The app works fine on Android. I tried to launch a template app (npx @react-native-community/cli@latest init Test) and it starts just fine. So I think it is a config issue on my side. My problem is that I don't know where to start in order to debug on this type of deep issue (c++ error). Since it is a config issue it is really complicated for me to setup a reproducer, I striped down my project to keep the bare minimum and provided the link to this.

My question is : if this error is not known, how to debug this type of error ?

Steps to reproduce

  1. Upgrade app from from 74.1 to 76.0.
  2. Compile and start from XCode.
  3. App crashes at startup.

React Native Version

0.76.0

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 15.0.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 268.17 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.1.0
    path: ~/.nvm/versions/node/v21.1.0/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.2.0
    path: ~/.nvm/versions/node/v21.1.0/bin/npm
  Watchman:
    version: 2024.09.23.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/benjaminbeau/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12483815
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.20.1
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/benjaminbeau/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 14.1.1
    wanted: ^14.1.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.0
    wanted: 0.76.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: false
  newArchEnabled: true

Stacktrace or Logs

2024-10-24 11:50:24.310785+0200 surloMobile[53882:2265559] [Mapbox] [Info, common]: Using Mapbox Common SDK v24.5.0(edbe9cbfd)
2024-10-24 11:50:24.315740+0200 surloMobile[53882:2265559] [Mapbox] [Info, maps-core]: Using Mapbox Core Maps SDK v11.5.0(e548448702)
2024-10-24 11:50:24.366175+0200 surloMobile[53882:2265559] [TSBackgroundFetch load]: (
)
2024-10-24 11:50:24.366718+0200 surloMobile[53882:2265559] [TSBGAppRefreshSubscriber load]: {
}
2024-10-24 11:50:24.405722+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Looking up debug dylib relative path
2024-10-24 11:50:24.410527+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Found debug dylib relative path string `surloMobile.debug.dylib`
2024-10-24 11:50:24.410544+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Looking up debug dylib entry point name
2024-10-24 11:50:24.410552+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] No debug dylib entry point name defined.
2024-10-24 11:50:24.410557+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Looking up debug dylib install name
2024-10-24 11:50:24.410565+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Found debug dylib install name string `@rpath/surloMobile.debug.dylib`
2024-10-24 11:50:24.410573+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Looking for Previews JIT link entry point.
2024-10-24 11:50:24.474952+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] No Previews JIT entry point found.
2024-10-24 11:50:24.474990+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Gave PreviewsInjection a chance to run and it returned, continuing with debug dylib.
2024-10-24 11:50:24.474998+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Looking for main entry point.
2024-10-24 11:50:24.475008+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Opening debug dylib with '@rpath/surloMobile.debug.dylib'
2024-10-24 11:50:24.475049+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Debug dylib handle: 0x200d5d4c0
2024-10-24 11:50:24.475060+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] No entry point found. Checking for alias.
2024-10-24 11:50:24.475072+0200 surloMobile[53882:2265559] [PreviewsAgentExecutorLibrary] Calling provided entry point.
2024-10-24 11:50:24.685208+0200 surloMobile[53882:2265841] [[FirebaseMessaging]] 11.4.0 - [FirebaseMessaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2024-10-24 11:50:24.829490+0200 surloMobile[53882:2265843] [connection] nw_socket_handle_socket_event [C1.1:2] Socket SO_ERROR [61: Connection refused]
2024-10-24 11:50:24.831571+0200 surloMobile[53882:2265843] [connection] nw_socket_handle_socket_event [C1.2:2] Socket SO_ERROR [61: Connection refused]
2024-10-24 11:50:24.832102+0200 surloMobile[53882:2265843] Connection 1: received failure notification
2024-10-24 11:50:24.832246+0200 surloMobile[53882:2265843] Connection 1: failed to connect 1:61, reason -1
2024-10-24 11:50:24.832280+0200 surloMobile[53882:2265843] Connection 1: encountered error(1:61)
2024-10-24 11:50:24.833721+0200 surloMobile[53882:2265843] Task <8A0B759E-48AB-4B06-A42D-5B1D65AC6FB1>.<1> HTTP load failed, 0/0 bytes (error code: -1004 [1:61])
2024-10-24 11:50:24.841309+0200 surloMobile[53882:2265842] Task <8A0B759E-48AB-4B06-A42D-5B1D65AC6FB1>.<1> finished with error [-1004] Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=61, NSUnderlyingError=0x2814747b0 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: lo0, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <8A0B759E-48AB-4B06-A42D-5B1D65AC6FB1>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <8A0B759E-48AB-4B06-A42D-5B1D65AC6FB1>.<1>"
), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=http://localhost:8081/status, NSErrorFailingURLKey=http://localhost:8081/status, _kCFStreamErrorDomainKey=1}
2024-10-24 11:50:24.858759+0200 surloMobile[53882:2265559] [HealthKit] Background observers added to the app
libc++abi: terminating with uncaught exception of type std::runtime_error: Feature flags were accessed before being overridden: fuseboxEnabledRelease

Reproducer

https://github.com/benjamin-beau/RN_crash

Screenshots and Videos

No response

did you solve the issue ?

kapilw360 avatar Dec 04 '24 16:12 kapilw360

the problem is in the AppDelegate of your app, not in React Native. What's happening is that your app is trying to access the React Native runtime before it is initialized.

can you show the AppDelegate code so I can guide you through it?

cipolleschi avatar Dec 04 '24 16:12 cipolleschi

the problem is in the AppDelegate of your app, not in React Native. What's happening is that your app is trying to access the React Native runtime before it is initialized.

can you show the AppDelegate code so I can guide you through it?

yes. im just doing that changes. i'll ping you. Thanxxx for reply.

kapilw360 avatar Dec 04 '24 16:12 kapilw360

#import "AppDelegate.h" #import <Firebase.h> #import "RCTAppleHealthKit.h" #import <React/RCTBundleURLProvider.h> #import <React/RCTLinkingManager.h> #import <React/RCTBridge+Private.h> // Added for accessing the current bridge #import <TSBackgroundFetch/TSBackgroundFetch.h> // Added for BackgroundFetch

@implementation AppDelegate

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.moduleName = @"Wellness360"; // Use your app's name // You can add your custom initial props in the dictionary below. // They will be passed down to the ViewController used by React Native. self.initialProps = @{};

    BOOL appLaunched = [super application:application didFinishLaunchingWithOptions:launchOptions]; if (!appLaunched) { return NO; }

    [FIRApp configure]; // Configure Firebase

    // [REQUIRED] Register BackgroundFetch [[TSBackgroundFetch sharedInstance] didFinishLaunching];

    // Initialize Background Observers for HealthKit [[RCTAppleHealthKit new] initializeBackgroundObservers:[RCTBridge currentBridge]];

    return appLaunched; }

  • (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { return [self bundleURL]; }

  • (NSURL *)bundleURL { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif }

  • (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { return [RCTLinkingManager application:application openURL:url options:options]; }

@end

This is my upgraded file but still its crashing

kapilw360 avatar Dec 04 '24 17:12 kapilw360

the problem is in the AppDelegate of your app, not in React Native. What's happening is that your app is trying to access the React Native runtime before it is initialized.

can you show the AppDelegate code so I can guide you through it? Hey the issue is solved. Thanks for you help.

kapilw360 avatar Dec 05 '24 05:12 kapilw360

The app is still crashing after migrating to 0.76 tried above given solution. still crashing. anyone having any clue?

hemant-mali-spg avatar Dec 05 '24 11:12 hemant-mali-spg

Hello There

Like @cipolleschi says, in my case was the AppDelegate (didFinishLaunchingWithOptions method).

I checked https://react-native-community.github.io/upgrade-helper/?from=0.75.2&to=0.76.3, and removed all no needed code from there

Hope it helps

FaggioniHQ avatar Dec 05 '24 12:12 FaggioniHQ

The app is still crashing after migrating to 0.76 tried above given solution. still crashing. anyone having any clue?

This has been fixed. thanks.

hemant-mali-spg avatar Dec 05 '24 13:12 hemant-mali-spg

The app is still crashing after migrating to 0.76 tried above given solution. still crashing. anyone having any clue?

This has been fixed. thanks.

Phew!!! early to comment...

I just checked in physical device. App is still crashing at least in physical device got EXC_BREAKPOINT. check screenshot

Screenshot 2024-12-06 at 4 09 09 PM

@cipolleschi @FaggioniHQ @kapilw360

hemant-mali-spg avatar Dec 06 '24 10:12 hemant-mali-spg

did you tried through command i means from vscode not from xcode ?

kapilw360 avatar Dec 06 '24 10:12 kapilw360

did you tried through command i means from vscode not from xcode ?

Using Xcode.

hemant-mali-spg avatar Dec 06 '24 10:12 hemant-mali-spg

try from vscode using cmd then see the error on metro

kapilw360 avatar Dec 06 '24 10:12 kapilw360

@hemant-mali-spg can you share your AppDelegate?

Also, I'd need the whole stack trace to understand what's going on. Even better, if you can provide a reproducer using this template.

cipolleschi avatar Dec 17 '24 15:12 cipolleschi

@cipolleschi , please take a look at this. It would be really helpful. I've been stuck on this for quite some time, and your assistance would be appreciated. stacktrash-app-crash-new-arch-ios.txt

hemant-mali-spg avatar Dec 17 '24 15:12 hemant-mali-spg

From the stack trace, it looks like that a Legacy Module is going through the interop layer and it is passing a null value to a string that is expected not to be null. But I can't help more than this because it depends on your specific setup.

Can you share your AppDelegate.mm?

cipolleschi avatar Dec 17 '24 15:12 cipolleschi

@cipolleschi here is the AppDelegate.mm

#import "AppDelegate.h" #import <Firebase.h>

#import <React/RCTBundleURLProvider.h>

@implementation AppDelegate

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } self.moduleName = @"moduleName"; // You can add your custom initial props in the dictionary below. // They will be passed down to the ViewController used by React Native. self.initialProps = @{};

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

  • (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { return [self bundleURL]; }

  • (NSURL *)bundleURL { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif }

@end

hemant-mali-spg avatar Dec 17 '24 15:12 hemant-mali-spg

Can you try with this change? I'm not sure, but if FIRApp does something, expecting React Native to be started, that might be causing the crash.

{
- if ([FIRApp defaultApp] == nil) {
- [FIRApp configure];
- }
self.moduleName = @"moduleName";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};

- return [super application:application didFinishLaunchingWithOptions:launchOptions];
+ BOOL appStarted = [super application:application didFinishLaunchingWithOptions:launchOptions];
+ if ([FIRApp defaultApp] == nil) {
+ [FIRApp configure];
+ }
+ return appStarted;
}

cipolleschi avatar Dec 17 '24 16:12 cipolleschi

@cipolleschi Well, no luck yet. is there anything to check with libraries I am using?

below are the libraries that does not support new arch.

Library: @react-native-voice/voice, supports new architecture: false Library: @stream-io/flat-list-mvcp, supports new architecture: false Library: buffer, supports new architecture: false Library: events, supports new architecture: false Library: jail-monkey, supports new architecture: false Library: react-native-code-push, supports new architecture: false Library: react-native-dynamic, supports new architecture: false Library: react-native-exception-handler, supports new architecture: false Library: react-native-fingerprint-scanner, supports new architecture: false Library: react-native-html-to-pdf, supports new architecture: false Library: react-native-orientation-locker, supports new architecture: false Library: react-native-securerandom, supports new architecture: false Library: react-native-sound, supports new architecture: false Library: react-native-tts, supports new architecture: false Library: react-native-version-info, supports new architecture: false Library: react-native-watch-connectivity, supports new architecture: false

Library: @amplitude/react-native, has native dependencies, you must ask the owner Library: @loadsmart/rn-salesforce-chat, has native dependencies, you must ask the owner Library: launchdarkly-react-native-client-sdk, has native dependencies, you must ask the owner Library: urbanairship-react-native, has native dependencies, you must ask the owner

could you please assist if these libs does not support new arch how to handle it?

hemant-mali-spg avatar Dec 17 '24 16:12 hemant-mali-spg

Which libraries are loaded when the app crashes? We load libraries lazily, so if it crashes at startup, we can limit them to the one loaded in the first screen.

Then we can create a reproducer using this template, by adding those libraries and we can see what's happening.

My guess is that one of them is passing a null string when we expect something that is not null, but with these steps we can isolate the faulty dependency.

cipolleschi avatar Dec 18 '24 15:12 cipolleschi

Hi @cipolleschi

Sure, I will provide the details soon. There is a similar open issue here: https://github.com/facebook/react-native/issues/48065#issuecomment-2557361324

hemant-mali-spg avatar Dec 20 '24 18:12 hemant-mali-spg

Hello @cipolleschi, I read all your comments to resolve app crash issue but I didn't, just for an reference I update react-native 0.74.3 to 0.76.6,.

ios app build successfully done, but app crash.

Here is the terminal log: (NOBRIDGE) LOG Bridgeless mode is enabled INFO 💡 JavaScript logs will be removed from Metro in React Native 0.77! Please use React Native DevTools as your default tool. Tip: Type j in the terminal to open (requires Google Chrome or Microsoft Edge). (NOBRIDGE) LOG Running "ProCheck" with {"rootTag":1,"initialProps":{"concurrentRoot":true},"fabric":true} Attaching the screenshot also:

Image

If anyone have solution please share, or if you want any other information let me know.

amitesh786 avatar Jan 16 '25 17:01 amitesh786

@amitesh786, please do not post on multiple issues. It will spread the information, making it hard to keep track of it, and it makes my job much harder.

I left instructions on how to debug this above (https://github.com/facebook/react-native/issues/47587#issuecomment-2551690265). Please follow them and report which library is crashing.

cipolleschi avatar Jan 16 '25 17:01 cipolleschi

@cipolleschi, I apologize if my actions made your task more challenging. I am seeking a solution as I’ve been struggling since updating React Native.

Nonetheless, I will proceed with your suggestion to identify and report which library is causing the crash.

amitesh786 avatar Jan 16 '25 18:01 amitesh786

Had this same issue. Was able to fix with suggestions from the second comment.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  self.moduleName = @"abc";
  self.initialProps = @{};

  BOOL appLaunched = [super application:application didFinishLaunchingWithOptions:launchOptions];
  if (!appLaunched) {
    return NO;
  }

  // ... other code

  return appLaunched;
}

Before the change, I had my return super call beneath a bunch of code.

RussMax783 avatar Apr 07 '25 16:04 RussMax783