React-native-splash-screen: iOS app crashes after splash screen is initialized version 3.2.0

Created on 29 Jun 2020  路  8Comments  路  Source: crazycodeboy/react-native-splash-screen

react: _16.9.0_
react-native: _0.61.5_

react-native-splash-screen: _3.2.0_

iOs issue

Once the application starts and the splash screen is shown, the application freezes and it is not working then. The splash screen is not hidden and I can go into my application.

Error from Xcode: "Could not load NIB in bundle: 'NSBundle..."

Show splash screen in AppDelegate.m

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

Most helpful comment

@tronginc @rickgrundy @metion @massoprod

The issue is, Xcode project is now updated in 0.63 with UIView nib to UIViewController in LaunchScreen.storyboard which means the function in native has to update and change view loading from nib to view controller...
Easy solution replace function showSplash with below given fixed code in file RNSplashScreen.m and set storyboard id see attachment below
Now it won't crash :)

+ (void)showSplash:(NSString*)splashScreen inRootView:(UIView*)rootView {
    if (!loadingView) {
        UIStoryboard *sb = [UIStoryboard storyboardWithName:splashScreen bundle:nil];
        UIViewController *vc = [sb instantiateViewControllerWithIdentifier:splashScreen];

        loadingView = vc.view;//[[[NSBundle mainBundle] loadNibNamed:splashScreen owner:self options:nil] objectAtIndex:0];
        CGRect frame = rootView.frame;
        frame.origin = CGPointMake(0, 0);
        loadingView.frame = frame;
    }
    waiting = false;

    [rootView addSubview:loadingView];
}

Screenshot 2020-08-31 at 10 27 58 AM

All 8 comments

Any solution? Please help

Running into this too. Having only [RNSplashScreen show]; in AppDelegate.m seems to work with getting the build to pass and run but I'm having issues with the SplashScreen hiding. The SplashScreen shows and never goes away. I verified in debug mode that the function to hide it is getting called in the correctly. Will circle back if I figure out the solution.

We hit the same "Could not load NIB in bundle" error after upgrading to react-native 0.63 and switching from LaunchScreen.xib to LaunchScreen.storyboard.

In our case it was solved by switching the "Main Interface" under Targets -> General -> Deployment Info to LaunchScreen.storyboard (you've probably already done this for "Launch Screen File").

Screen Shot 2020-08-03 at 12 45 57 pm

Same here

@tronginc @rickgrundy @metion @massoprod

The issue is, Xcode project is now updated in 0.63 with UIView nib to UIViewController in LaunchScreen.storyboard which means the function in native has to update and change view loading from nib to view controller...
Easy solution replace function showSplash with below given fixed code in file RNSplashScreen.m and set storyboard id see attachment below
Now it won't crash :)

+ (void)showSplash:(NSString*)splashScreen inRootView:(UIView*)rootView {
    if (!loadingView) {
        UIStoryboard *sb = [UIStoryboard storyboardWithName:splashScreen bundle:nil];
        UIViewController *vc = [sb instantiateViewControllerWithIdentifier:splashScreen];

        loadingView = vc.view;//[[[NSBundle mainBundle] loadNibNamed:splashScreen owner:self options:nil] objectAtIndex:0];
        CGRect frame = rootView.frame;
        frame.origin = CGPointMake(0, 0);
        loadingView.frame = frame;
    }
    waiting = false;

    [rootView addSubview:loadingView];
}

Screenshot 2020-08-31 at 10 27 58 AM

@AlishahSolanki This is the solution when using a storyboard.

Didn't see a PR so ... https://github.com/crazycodeboy/react-native-splash-screen/pull/502

UPDATE - i'm getting black screen flash immediately prior to the splash screen showing up. Only happens on device, not simulator. Only on iOS. Android working ok.

@tronginc @rickgrundy @metion @massoprod

The issue is, Xcode project is now updated in 0.63 with UIView nib to UIViewController in LaunchScreen.storyboard which means the function in native has to update and change view loading from nib to view controller...
Easy solution replace function showSplash with below given fixed code in file RNSplashScreen.m and set storyboard id see attachment below
Now it won't crash :)

+ (void)showSplash:(NSString*)splashScreen inRootView:(UIView*)rootView {
    if (!loadingView) {
        UIStoryboard *sb = [UIStoryboard storyboardWithName:splashScreen bundle:nil];
        UIViewController *vc = [sb instantiateViewControllerWithIdentifier:splashScreen];

        loadingView = vc.view;//[[[NSBundle mainBundle] loadNibNamed:splashScreen owner:self options:nil] objectAtIndex:0];
        CGRect frame = rootView.frame;
        frame.origin = CGPointMake(0, 0);
        loadingView.frame = frame;
    }
    waiting = false;

    [rootView addSubview:loadingView];
}

Screenshot 2020-08-31 at 10 27 58 AM

How do I set storyboard id? No idea where this screenshot is from

@tronginc @rickgrundy @metion @massoprod
The issue is, Xcode project is now updated in 0.63 with UIView nib to UIViewController in LaunchScreen.storyboard which means the function in native has to update and change view loading from nib to view controller...
Easy solution replace function showSplash with below given fixed code in file RNSplashScreen.m and set storyboard id see attachment below
Now it won't crash :)

+ (void)showSplash:(NSString*)splashScreen inRootView:(UIView*)rootView {
    if (!loadingView) {
        UIStoryboard *sb = [UIStoryboard storyboardWithName:splashScreen bundle:nil];
        UIViewController *vc = [sb instantiateViewControllerWithIdentifier:splashScreen];

        loadingView = vc.view;//[[[NSBundle mainBundle] loadNibNamed:splashScreen owner:self options:nil] objectAtIndex:0];
        CGRect frame = rootView.frame;
        frame.origin = CGPointMake(0, 0);
        loadingView.frame = frame;
    }
    waiting = false;

    [rootView addSubview:loadingView];
}

Screenshot 2020-08-31 at 10 27 58 AM

How do I set storyboard id? No idea where this screenshot is from

image

You can view it in your Inspectors pane. Then it will be under Show the Identity Inspector tab

Was this page helpful?
0 / 5 - 0 ratings