Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
benjamin-beau opened this issue Oct 25, 2024 · 26 comments
Assignees

Comments

@benjamin-beau
Copy link

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

@cipolleschi
Copy link
Contributor

cipolleschi commented Oct 26, 2024

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.

@hellogbg

This comment was marked as off-topic.

@cipolleschi
Copy link
Contributor

@benjamin-beau did you solve your issue?

@FaggioniHQ
Copy link

Hello There,

Any workaround for this?

Thanks in advance

@cipolleschi
Copy link
Contributor

@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

@FaggioniHQ
Copy link

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

@kapilw360
Copy link

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 ?

@cipolleschi
Copy link
Contributor

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?

@kapilw360
Copy link

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
Copy link

#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
Copy link

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.

@hemant-mali-spg
Copy link

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

@FaggioniHQ
Copy link

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

@hemant-mali-spg
Copy link

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
Copy link

hemant-mali-spg commented Dec 6, 2024

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

@kapilw360
Copy link

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

@hemant-mali-spg
Copy link

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

Using Xcode.

@kapilw360
Copy link

try from vscode using cmd then see the error on metro

@cipolleschi
Copy link
Contributor

@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.

@hemant-mali-spg
Copy link

@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

@cipolleschi
Copy link
Contributor

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?

@hemant-mali-spg
Copy link

@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

@cipolleschi
Copy link
Contributor

cipolleschi commented Dec 17, 2024

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;
}

@hemant-mali-spg
Copy link

@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?

@cipolleschi
Copy link
Contributor

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.

@hemant-mali-spg
Copy link

Hi @cipolleschi

Sure, I will provide the details soon. There is a similar open issue here: #48065 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants