react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

[V3 or V2] iOS stuck on black screen on launch

Open Shane-Loong opened this issue 7 years ago • 9 comments

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

Shane-Loong avatar Oct 10 '19 22:10 Shane-Loong

I encounter the same probelm

acollazomayer avatar Oct 16 '19 18:10 acollazomayer

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 avatar Nov 07 '19 21:11 RyanCommits

@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.

Shane-Loong avatar Nov 07 '19 21:11 Shane-Loong

@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.

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.

rhayart avatar Dec 04 '19 09:12 rhayart

@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.

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 avatar Dec 04 '19 15:12 RyanCommits

@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.

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.

rhayart avatar Dec 04 '19 16:12 rhayart

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.

stale[bot] avatar Jan 09 '20 20:01 stale[bot]

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!

Shane-Loong avatar Jan 09 '20 20:01 Shane-Loong

I had same issue. And I solved it by killing the LLDB process and run app again (even without rebuilding).

tyson90 avatar Aug 20 '21 09:08 tyson90