[iOS] RCTLogBoxView crashes on dealloc when app uses SceneDelegate because it still assumes AppDelegate.window exists
まだ誰も着手していません。
- 主要言語
- C++
- スター
- 127k
- フォーク
- 25.3k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 4
説明
Description
When using a SceneDelegate-based iOS app lifecycle, React Native crashes in RCTLogBoxView during deallocation because it still accesses RCTSharedApplication().delegate.window.
The following code in RCTLogBoxView is problematic:
- (void)dealloc
{
#if !TARGET_OS_MACCATALYST // sharedApplication.delegate is not available on Mac Catalyst
[RCTSharedApplication().delegate.window makeKeyWindow];
#endif
}
In a SceneDelegate setup, the app’s main window is typically owned by the active UIWindowScene, not exposed as AppDelegate.window. As a result, this code can crash with an unrecognized selector / invalid access depending on how the app delegate is implemented.
This looks like the same broader class of SceneDelegate compatibility issues as other places in React Native that still assume application.delegate.window exists.
Steps to reproduce
- Create a React Native app on iOS
- Adopt SceneDelegate / UIScene lifecycle
- Ensure the app delegate does not expose a window property
- Trigger LogBox presentation and dismissal / teardown in development
- Observe crash when RCTLogBoxView is deallocated
React Native Version
0.83.0
Output of npx @react-native-community/cli info
npx @react-native-community/cli info
Screenshots and Videos
RCTLogBoxView
- (void)dealloc
{
#if !TARGET_OS_MACCATALYST
[RCTSharedApplication().delegate.window makeKeyWindow];
#endif
}
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず RCTLogBoxView を見つけて、その dealloc 実装、特に RCTSharedApplication().delegate.window へのアクセスを読みます。SceneDelegate ベースのアプリで teardown のフローを再現し、その後、既存の動作を維持したまま LogBox の dismiss と deallocation でクラッシュが発生しなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- ios, objective-c, react-native
- 領域
- mobile-dev
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 58/100