XCode 12: 'Application windows are expected to have a root view controller at the end of application launch'

I'm having an issue when running an app on Xcode using the release build. The debug one works just fine tho.

When I try to run the app, this code (on main.m):

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char * argv[]) {
  @autoreleasepool {
    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
  }
}

throws me the following error message:

2021-08-26 12:40:55.833657-0500 profile[2870:97150] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
terminating with uncaught exception of type NSException

I've searched to many solutions, to no avail. Can anyone help me? By the way, it probably deserves no mention, but I've disabled the Storyboard 'Launch Screen' at the beggining of my app, since I've already one defined before testing the app in the re

Answered by MobileTen in 686038022

Just means your initial view controller is failing to initialize properly and hence this relationship is nil.

 window.rootViewController = viewController

Check your storyboard connections, check the target main window is also referring to the main storyboard, check the connections in the storyboard, etc ...

Accepted Answer

Just means your initial view controller is failing to initialize properly and hence this relationship is nil.

 window.rootViewController = viewController

Check your storyboard connections, check the target main window is also referring to the main storyboard, check the connections in the storyboard, etc ...

XCode 12: 'Application windows are expected to have a root view controller at the end of application launch'
 
 
Q