-
-
Notifications
You must be signed in to change notification settings - Fork 534
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
Crashes on iOS #1857
Comments
Hey! 👋 It looks like you've omitted a few important sections from the issue template. Please complete Snack or a link to a repository section. |
Hey! 👋 The issue doesn't seem to contain a minimal reproduction. Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem? |
Hi @adamivancza, have you found a solution for this crash? We have the same problem with CarPlay. |
@nicomontanari the second one doesn't seem to happen anymore for us. We've updated to 6.37.0 recently which might fixed this. But the first one is still happening, but very rarely. Didn't find a solution yet. |
@adamivancza ok thank you 😥 If we find a solution I'll tell you! :) |
@nicomontanari awesome, thank you :) |
We are experiencing the same issue when trying to connect to CarPlay without opening the iPhone app. |
Not the best solution, but I finally decided to turn off react native screens in my project:
My app works now good in Carplay and in my iPhone. |
Hi @adamivancza, thanks for submitting this issue! |
@mursang good catch. |
hey @nicomontanari, yes, I am using react navigation:
and nothing seems to have changed in my app after applying that line of code :) |
@tboba I wasn't able to repro the app myself but I can share the breadcrumbs that bugsnag collects in case that helps. This is a fully react-native app. app displays a full screen modal using react-navigation |
We're seeing the first one over here as well ( |
We got the same error when trying to open the CarPlay app with the iPhone app closed. I'm not an objective-c expert, but I think I found the source of the bug. In
If I add a check like this before the above code the app is not crashing |
Thanks for doing the leg work on this @casperolesen. That check makes the app work correctly on CarPlay, but we need to add additional handling for when an app is opened on device after it is opened on CarPlay. Here is a complete patch for the orientation issue. diff --git a/node_modules/react-native-screens/ios/RNSScreenWindowTraits.mm b/node_modules/react-native-screens/ios/RNSScreenWindowTraits.mm
index e8a717e..ea3b2a7 100644
--- a/node_modules/react-native-screens/ios/RNSScreenWindowTraits.mm
+++ b/node_modules/react-native-screens/ios/RNSScreenWindowTraits.mm
@@ -178,7 +178,21 @@
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_16_0
if (@available(iOS 16.0, *)) {
NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];
- UIWindowScene *scene = (UIWindowScene *)array[0];
+
+ // when an app supports multiple scenes (e.g. CarPlay), it is possible that
+ // UIWindowScene is not the first scene, or it may not be present at all
+ UIWindowScene *scene = nil;
+ for (id connectedScene in array) {
+ if ([connectedScene isKindOfClass:[UIWindowScene class]]) {
+ scene = connectedScene;
+ break;
+ }
+ }
+
+ if (scene == nil) {
+ return;
+ }
+
UIWindowSceneGeometryPreferencesIOS *geometryPreferences =
[[UIWindowSceneGeometryPreferencesIOS alloc] initWithInterfaceOrientations:orientationMask];
[scene requestGeometryUpdateWithPreferences:geometryPreferences |
Hi @adamivancza, could you check if the patch submitted above fixes both of the crashes? |
yep @tboba - will try it out and let you know. I'll need ~2 weeks to check on Bugsnag if it is all good. |
#2035) ## Description This fixes two issues with scenes on iOS: 1. A casting issue, which allows non-window scenes on iOS, e.g. CarPlay's CPTemplateApplicationScene 3. An assumed loading order - the UIWindowScene is not guaranteed to be the first scene (or even present) in a multi-scene app Fixes #1857 **Edit:** I originally reported that this would only fix the second crash reported in #1857. Upon review of the first crash in that issue, I believe this PR actually addresses both crashes. ## Test code and steps to reproduce There really isn't any simple code that can be used to test this, as this scenario requires having an app that implements multiple scenes, at least one of which being CarPlay. It would be several hundred lines of code. ## Checklist - [x] Ensured that CI passes
Re-opening it, since the PR had a |
Hi @adamivancza! Do you have any updates, regarding this issue? |
hey @tboba! sooo sorry but I forgot about this 😅 I've updated our version to 3.30.0 which has the same fix. We will release this update to our users next Monday so I can give you updates sometime next week! |
@adamivancza Great! Keep me updated 😄 |
@tboba the fix seems to work - can't see this crash anymore |
@adamivancza Great to hear that! Let's close this issue then 😄 |
software-mansion#2035) ## Description This fixes two issues with scenes on iOS: 1. A casting issue, which allows non-window scenes on iOS, e.g. CarPlay's CPTemplateApplicationScene 3. An assumed loading order - the UIWindowScene is not guaranteed to be the first scene (or even present) in a multi-scene app Fixes software-mansion#1857 **Edit:** I originally reported that this would only fix the second crash reported in software-mansion#1857. Upon review of the first crash in that issue, I believe this PR actually addresses both crashes. ## Test code and steps to reproduce There really isn't any simple code that can be used to test this, as this scenario requires having an app that implements multiple scenes, at least one of which being CarPlay. It would be several hundred lines of code. ## Checklist - [x] Ensured that CI passes
Description
I've noticed 2 crashes in our app related to this library. I'm pasting the crash reports from Bugsnag.
Crash 1
Possible cause
App is backgrounded then possibly change orientation? I only saw this issue on iOS 16.5.1 so it might be related to this certain iOS version?
Crashlog
Crash 2
Possible cause
This function seems to be running into an infinite loop. We're displaying a modal screen prior to this crash so I assume that might be the cause. Found this existing bug report too: #1678
Crashlog
Steps to reproduce
Sadly not entirely sure
Snack or a link to a repository
Screens version
3.22.1
React Native version
0.71.8
Platforms
Android, iOS
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
Release mode
Device
Real device
Device model
any iPhone
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: