[V3 or V2] iOS stuck on black screen on launch
Issue Description
When I try to run my app on an iOS device, it loads up but only shows a black screen. I managed to resolve this issue by modifying the code in RNNSplashScreen.m line: 74:
From:
if (viewController != nil) {
id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
appDelegate.window.rootViewController = viewController;
[appDelegate.window makeKeyAndVisible];
}
To:
if (viewController != nil) {
viewController = [[RNNSplashScreen alloc] init];
}
id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
appDelegate.window.rootViewController = viewController;
[appDelegate.window makeKeyAndVisible];
I was wondering if anyone has encountered this issue? Or is it a problem on my end? If not, I can submit a PR for this.
Environment
- React Native Navigation version: any v2 or v3
- React Native version: 0.59.10
- Platform(s) (iOS, Android, or both?): iOS
- Device info (Simulator/Device? OS version? Debug/Release?): Simulator and Device
I encounter the same probelm
Getting this error when using your fix:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
@RyanCommits Try:
viewController = [[RNNSplashScreen alloc] init];
viewController.view = [[UIImageView alloc] initWithImage:image];
}
id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
appDelegate.window.rootViewController = viewController;
[appDelegate.window makeKeyAndVisible];
}
Where the viewController initialization is in the else statement above.
@RyanCommits Try:
viewController = [[RNNSplashScreen alloc] init]; viewController.view = [[UIImageView alloc] initWithImage:image]; } id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate; appDelegate.window.rootViewController = viewController; [appDelegate.window makeKeyAndVisible]; }Where the
viewControllerinitialization is in theelsestatement above.
Same issue here, and this fix it. @ShaneMatthias, could you submit a PR for this ? It's seem we are not as much having this issue, it's weird.
@RyanCommits Try:
viewController = [[RNNSplashScreen alloc] init]; viewController.view = [[UIImageView alloc] initWithImage:image]; } id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate; appDelegate.window.rootViewController = viewController; [appDelegate.window makeKeyAndVisible]; }Where the
viewControllerinitialization is in theelsestatement above.
I resolved my issue. The problem was that the Launch Screen File property, under General > App Icons and Launch Images, was empty. Apparently this causes RNN to not have a "Root View" on app launch and caused a black screen for me.
@RyanCommits Try:
viewController = [[RNNSplashScreen alloc] init]; viewController.view = [[UIImageView alloc] initWithImage:image]; } id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate; appDelegate.window.rootViewController = viewController; [appDelegate.window makeKeyAndVisible]; }Where the
viewControllerinitialization is in theelsestatement above.I resolved my issue. The problem was that the Launch Screen File property, under General > App Icons and Launch Images, was empty. Apparently this causes RNN to not have a "Root View" on app launch and caused a black screen for me.
I just tried it and it does the trick thank you.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
For some reason, I stopped receiving notifications for this issue. @RyanCommits I can't seem to find where to locate this path and how to fix it. Could you explain? Thanks
EDIT: Nevermind! I found and fixed it. Thanks!
I had same issue. And I solved it by killing the LLDB process and run app again (even without rebuilding).