You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[iOS] RCTLogBoxView crashes on dealloc when app uses SceneDelegate because it still assumes AppDelegate.window exists #56571
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
Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:
For majority of bugs: send us a Pull Request with the RNTesterPlayground.js edited to reproduce your bug.
Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:
For majority of bugs: send us a Pull Request with the RNTesterPlayground.js edited to reproduce your bug.
If your bug is build/upgrade related: a project using our Reproducer Template
You can read more about about it on our website: How to report a bug. A reproducer should not be necessary here, because the root cause of the crash is already clear.
The crash happens in RCTLogBoxView’s dealloc method:
This assumes that UIApplication.sharedApplication.delegate.window is always available. However, in apps using SceneDelegate, the app delegate may not own a window, so delegate.window can be nil or invalid.
The implementation should not rely on sharedApplication.delegate.window. It should instead obtain the appropriate window from the active UIWindowScene, or avoid calling makeKeyWindow from dealloc altogether.
A possible concise version:
No reproducer is needed in this case. The root cause is clear: RCTLogBoxView assumes UIApplication.sharedApplication.delegate.window exists, but this is not true for apps using SceneDelegate. This can cause a crash when dealloc calls makeKeyWindow on delegate.window.
Activity
react-native-bot commentedon Apr 23, 2026
Warning
Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:
You can read more about about it on our website: How to report a bug.
zhfwch commentedon Apr 28, 2026
The crash happens in RCTLogBoxView’s dealloc method:
This assumes that UIApplication.sharedApplication.delegate.window is always available. However, in apps using SceneDelegate, the app delegate may not own a window, so delegate.window can be nil or invalid.
The implementation should not rely on sharedApplication.delegate.window. It should instead obtain the appropriate window from the active UIWindowScene, or avoid calling makeKeyWindow from dealloc altogether.
A possible concise version:
No reproducer is needed in this case. The root cause is clear: RCTLogBoxView assumes UIApplication.sharedApplication.delegate.window exists, but this is not true for apps using SceneDelegate. This can cause a crash when dealloc calls makeKeyWindow on delegate.window.
fix(example): adopt UIScene lifecycle for Xcode 27 (#843)
fix(example): adopt UIScene lifecycle for Xcode 27 (lodev09#843)
react-native-bot commentedon Oct 25, 2026
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.