React-native-splash-screen: Crash on Splash Screen iOS 12.3.1

Created on 13 Jun 2019  路  15Comments  路  Source: crazycodeboy/react-native-splash-screen

Run react-native info in your project and share the content.

Environment:
  OS: macOS 10.14.5
  Node: 10.15.3
  Yarn: 1.16.0
  npm: 6.4.1
  Watchman: 4.9.0
  Xcode: Xcode 10.2.1 Build version 10E1001
  Android Studio: 3.4 AI-183.5429.30.34.5452501

Packages: (wanted => installed)
  react: 16.3.1 => 16.3.1
  react-native: ^0.55.4 => 0.55.4

What react-native-splash-screen version are you using?

"react-native-splash-screen": "^3.0.9",

What platform does your issue occur on? (Android/iOS/Both)

iOS

Describe your issue as precisely as possible :
1) Steps to reproduce the issue or to explain in which case you get the issue

The issue usually happens when I submit the app for release to TestFlight. At the moment it's being rejected, cause they only receive a blank screen. I'm unable to reproduce the bug locally.

2) Interesting logs

Join a screenshot or video of the problem on the simulator or device?

apple-rejection-blank-splash-screen-bug

Show us the code you are using?

Most helpful comment

I can confirm using

@ou2s

Just to confirm. You are saying you fixed the issue by using

[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];

Instead of

[RNSplashScreen show]

Or did you use something else IE showSplash:inRootView:

I can confirm using :
[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];
instead of
[RNSplashScreen show]

fixed crash for me.

All 15 comments

I'm having the same bug.
Everything works fine in debug / release mode on simulator / real device but it fails when the builds comes from Testflight.

What you could do is look at your device crash logs (CMD + SHIFT + 2 in Xcode with your device plugged in). From my logs it seems that l31 of the RNSplashScreen.m is responsible for the crash:

image

This very same line was already discussed because of BAD ACCESS issue a year ago: https://www.bountysource.com/issues/49406480-splashscreen-show-crashes-with-exc_bad_access

image

Apparently the app gets killed by the OS because it takes too much time to load. Maybe the loop does not stop early enough (in my case I call RNSplashScreen.hide() very late in my react-native code). Check this SO issue for more info: https://stackoverflow.com/questions/50186258/app-crash-exception-type-exc-crash-sigkill-termination-reason-namespace-spri.

I'll try to dig a bit !

I just read this thread that talks about a related issue: https://forums.developer.apple.com/thread/88529.
In their case it was the OS that was not handling correctly the end of a background task, but still it helps understand a bit more what's happening for us :)

I experience the same issue. Any update on this?

I was the one that had posted the issue. I have not dig more into it, cause it sort of disapear on my end and I could not tested anymore.

I can confirm this bug and it seems to only happen on testflight builds for us. It is a showstopper unfortunately.

Any luck here from anyone? Started to hit this as well

Same here, any luck?

image

FYI, I will try to use [RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView]; instead of [RNSplashScreen show]. You just have to create a View (.xib) via Xcode.

It seems like it's fixing the problem since it won't go into the Run Loop that was causing the crash.

EDIT: I confirm that you can workaround this issue by using the showSplash:inRootView: method instead of show (cc @corelmax @chevonc @mcorner @sebiVPS @colaskirschoff )

@ou2s

Just to confirm. You are saying you fixed the issue by using

[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];

Instead of

[RNSplashScreen show]

Or did you use something else IE showSplash:inRootView:

Facing the same issue here

EDIT: I just figured out that the issue wasn't related to react-native-splash-screen directly.

I can confirm using

@ou2s

Just to confirm. You are saying you fixed the issue by using

[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];

Instead of

[RNSplashScreen show]

Or did you use something else IE showSplash:inRootView:

I can confirm using :
[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];
instead of
[RNSplashScreen show]

fixed crash for me.

@ou2s

Just to confirm. You are saying you fixed the issue by using

[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];

Instead of

[RNSplashScreen show]

Or did you use something else IE showSplash:inRootView:

Yes I confirm.

FYI, showSplash:inRootView: is not something else. It's the method name in Objective-C used in this code: _[RNSplashScreen showSplash:@"LaunchScreen" inRootView: rootView]_.
Another example is: show is the method name in [RNSplashScreen show].

Looks like [RNSplashScreen show] has some strange while (waiting) => while (true) in its code. The other method [RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView]; has a bit different code. I think it fixes issue for me as well.

Same here, Any solution ?

I was having the same issues with expo-updates and the trick of changing to inRootView worked.

Note that expo already creates a root view for you, so you just need to add RNSplashScreen in to it. So instead of before the return YES you need to add it at the end of initializeReactNativeApp

  return YES;
}

- (RCTBridge *)initializeReactNativeApp
{
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  [RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];

  return bridge;
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

luskin picture luskin  路  4Comments

jassonha21 picture jassonha21  路  3Comments

luqingxuan picture luqingxuan  路  3Comments

zhaogao picture zhaogao  路  4Comments

leishi8819 picture leishi8819  路  3Comments