react-native: XCode 15 iOS 12 Build Bridge Crash: Thread 1: EXC_BAD_ACCESS

Description

I tried it in xCode 14 and there is no crash. But xCode 15 i tried Debug/Release and the result is the same:

React Native 0.70.13: AwesomeProject-0 70 13

React Native 0.62.3 - 0.68.7: AwesomeProject-0 68 7

React Native Version

0.70.13

Output of npx react-native info

System: OS: macOS 13.5.2 CPU: (12) arm64 Apple M2 Pro Memory: 1.50 GB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 14.21.3 - /opt/homebrew/bin/node Yarn: Not Found npm: 6.14.18 - /opt/homebrew/bin/npm Watchman: 2023.07.24.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0 Android SDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9514443 Xcode: 15.0/15A240d - /usr/bin/xcodebuild Languages: Java: 11.0.18 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.13 => 0.70.13 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

npx react-native init AwesomeProject --version 0.70.13 npx react-native run-ios

Snack, screenshot, or link to a repository

Unknown

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Reactions: 1
  • Comments: 27 (5 by maintainers)

Most upvoted comments

The fix is to add the -Wl -ld_classic flags to Xcode’s OTHER_LDFLAGS build settings. You need to apply it to both the main project and the Pods project.

Consider that after doing it, every build with Xcode < 15 will fail as those flags are new to Xcode 15 only. So if you are building your app in CI with an older version of Xcode you’ll see failures and you’ll have to remove those flags.

As final note, React Native 0.68 is not supported anymore, as explained by the Release Support Window. Please, find the time to update the app to a supported version of React Native, to benefit from future patch releases.

We are aware of the problem and we have a fix for it. The Release Crew is releasing new versions of React Native in these weeks, starting from 0.73 and back to 0.70 to fix the issue. Thanks for your patience.

When I created a new project, I could not see a problem, but even if I reinstalled the pods in my existing project, the result did not change. I looked at the difference between the new project and my existing project.

If your project has a Swift bridging header, an error like this occurs:

Xcode Thread 1:

dyld`:
    0x102eba410 <+0>:  mov    x16, #0x209
    0x102eba414 <+4>:  svc    #0x80
->  0x102eba418 <+8>:  b.lo   0x102eba430               ; <+32> == Thread 1: signal SIGABRT
    0x102eba41c <+12>: stp    x29, x30, [sp, #-0x10]!
    0x102eba420 <+16>: mov    x29, sp
    0x102eba424 <+20>: bl     0x102eb9850               ; cerror_nocancel
    0x102eba428 <+24>: mov    sp, x29
    0x102eba42c <+28>: ldp    x29, x30, [sp], #0x10
    0x102eba430 <+32>: ret    

Xcode Console:

dyld: Library not loaded: /System/Library/Frameworks/SwiftUI.framework/SwiftUI
Referenced from: /var/containers/Bundle/Application/C4645550-997A-452B-B65D-013EAE5FB0EF/AwesomeProject.app/AwesomeProject
Reason: image not found

Edit: I solved the problem like this: https://stackoverflow.com/a/60991366/2649770 There doesn’t seem to be a problem for now. @hezhii @tarouboy If you are getting the same error, can you try this way?

Hopefully, the release crew will be able to release 0.71 and 0.72 by EOW

Yes I will work, the simple template app is working on 0.72.5. You can try with npx react-native init MyNewApp and it will run on a device with ios 12. Unfortunately we can’t update to 0.72.5 yet because we use detox to run our tests and they dont support 0.72. So I hope this will have a fix soon.

+1

We have the same crash as in your second screenshot (0.62.3-0.68.7) (Maybe since were not using flipper?). We’re running 0.71.13. Our app crash on startup for devices running ios 12. (testing on iPhone 6 plus running 12.5.6)

When creating a new project from npx react-native@0.71.13 init xc15ios12test --version 0.71.13 I get the same crash as your first image. I guess flipper is enabled by default.

Edit: Works on RN 0.72.5

When I created a new project, I could not see a problem, but even if I reinstalled the pods in my existing project, the result did not change. I looked at the difference between the new project and my existing project.

If your project has a Swift bridging header, an error like this occurs:

Xcode Thread 1:

dyld`:
    0x102eba410 <+0>:  mov    x16, #0x209
    0x102eba414 <+4>:  svc    #0x80
->  0x102eba418 <+8>:  b.lo   0x102eba430               ; <+32> == Thread 1: signal SIGABRT
    0x102eba41c <+12>: stp    x29, x30, [sp, #-0x10]!
    0x102eba420 <+16>: mov    x29, sp
    0x102eba424 <+20>: bl     0x102eb9850               ; cerror_nocancel
    0x102eba428 <+24>: mov    sp, x29
    0x102eba42c <+28>: ldp    x29, x30, [sp], #0x10
    0x102eba430 <+32>: ret    

Xcode Console:

dyld: Library not loaded: /System/Library/Frameworks/SwiftUI.framework/SwiftUI
Referenced from: /var/containers/Bundle/Application/C4645550-997A-452B-B65D-013EAE5FB0EF/AwesomeProject.app/AwesomeProject
Reason: image not found

Edit: I solved the problem like this: https://stackoverflow.com/a/60991366/2649770 There doesn’t seem to be a problem for now. @hezhii @tarouboy If you are getting the same error, can you try this way?

It works!!

Edit: I solved the problem like this: https://stackoverflow.com/a/60991366/2649770 There doesn’t seem to be a problem for now. @hezhii @tarouboy If you are getting the same error, can you try this way?

Just updated my Xcode to 15.1 today, didn’t help. But after linking the SwiftUI manually it works! Thanks @mronline !!!

Ahh 😅 I think maybe it already was released? 0.71.14? There was something about the flag in there at least -ld_classic.

Anyone have the code for adding appending this via Podfile since podsproject is wiped on pod install?

edit: or if its better to apply a patch package that sets something in a podspec perhaps?

edit 2: nvm, I found the commit and wrote a patch for 0.71

https://gist.github.com/frenberg/8c873008e9844d39dafb858c3d0bdb4f gist if someone needs it

@cipolleschi Can you please share the fix PR. We’re on 0.68.2 and cannot do a React upgrade at this moment so need to check if we could patch that changes.