react / react/react-native

Bug Report: Duplicate RCTSwiftUI Symbol Leakage Causes lowercaseString Crash in RN 0.84 Prebuilt Frameworks

オープン
#55,978 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Needs: Attention Needs: Version Info
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

Description

Description
In React Native 0.84 (New Architecture), apps that include custom Swift modules or import React in AppDelegate.swift crash deterministically on iOS launch before the JS bundle evaluates. The crash is -[NSMallocBlock lowercaseString]: unrecognized selector sent to instance.

Root Cause Analysis:
This is a framework-level linker bug caused by the new prebuilt React.framework and ENABLE_DEBUG_DYLIB features.

React.framework (and the .debug.dylib) comes prebuilt with exposed Swift symbols, specifically RCTSwiftUI and RCTEventEmitter.

When the main app target compiles AppDelegate.swift (which imports React), the Swift compiler statically links those exposed RCTSwiftUI symbols directly into the main app executable.

At runtime, dyld loads the main executable AND the React.framework (or .debug.dylib). Both binaries now contain the exact same Swift classes.

The Objective-C runtime duplicate class registration corrupts the dispatch table. When the TurboModule system initializes, it sends a string method (lowercaseString) to a corrupted pointer (an NSMallocBlock), causing a fatal crash.

Steps to reproduce

Steps to Reproduce:

Initialize a React Native 0.84 project with New Architecture enabled.

Add a basic Swift file to the main iOS target that imports React (or just rely on the default AppDelegate.swift).

Build for an iOS physical device (xcodebuild -workspace ...).

Crash occurs immediately upon boot.
(Note: Setting ENABLE_DEBUG_DYLIB=NO strips the dylib, but the crash persists because the duplicate symbols still exist between the main executable and the prebuilt React.framework).

Expected Behavior
Prebuilt React frameworks should have their internal Swift symbols (like RCTSwiftUI) stripped or marked with hidden visibility so they do not leak into the consumer's main app binary during compilation.

React Native Version

0.84.x

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info
System:
  OS: macOS 15.7.4
  CPU: (10) arm64 Apple M4
  Memory: 2.81 GB / 24.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 24.12.0
    path: /Users/avacado/.nvm/versions/node/v24.12.0/bin/node
  Yarn: Not Found
  npm:
    version: 11.6.2
    path: /Users/avacado/.nvm/versions/node/v24.12.0/bin/npm
  Watchman:
    version: 2026.01.12.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.3 AI-253.29346.138.2531.14876573
  Xcode:
    version: 26.3/17C529
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.18
    path: /opt/homebrew/opt/openjdk@17/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.1.0
    wanted: 20.1.0
  react:
    installed: 19.2.3
    wanted: 19.2.3
  react-native:
    installed: 0.84.1
    wanted: ^0.84.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
Stacktrace or Logs
Fatal Exception: NSInvalidArgumentException
-[__NSMallocBlock__ lowercaseString]: unrecognized selector sent to instance

Crash Timeline Context:
1. iOS launches the app binary successfully.
2. React Native's prebuilt React.framework loads (registers RCTSwiftUI / RCTEventEmitter classes).
3. LocalMind.debug.dylib loads (registers duplicate RCTSwiftUI / RCTEventEmitter classes).
4. Duplicate class registration corrupts the Objective-C runtime dispatch table.
5. React Native attempts to evaluate the JavaScript bundle.
6. A TurboModule or Event Emitter attempts string manipulation, routing the method to a corrupted pointer (a memory block instead of an NSString).
7. Hard crash before any application-level JS or native code can execute.

Note: Setting ENABLE_DEBUG_DYLIB=NO in the xcodebuild command successfully strips the .debug.dylib, but the crash persists because the main application executable still statically links the duplicate RCTSwiftUI symbols from AppDelegate.swift importing the prebuilt React.framework.
MANDATORY Reproducer

https://github.com/marinoonthelake-blip/test

Screenshots and Videos

N/A - This is a deterministic compiler/linker crash that occurs at launch before the React Native view hierarchy is mounted.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Reactをimportする必須のreproducerとデフォルトのAppDelegate.swiftパスから始め、次に、事前ビルドされたReact.frameworkと.debug.dylibがどのように生成され、xcodebuildによってリンクされるかを調査します。アプリとフレームワークの出力にある重複したRCTSwiftUIおよびRCTEventEmitterシンボルを確認します。reproducerがlowercaseStringクラッシュなしで起動し、consumerバイナリに重複シンボルが含まれなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
ios, react-native, swift
領域
build-system, mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。