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

Hi I need help in getting an older app to compile and run using Xcode 8:


I'm getting th following error:


Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(
  0   CoreFoundation                      0x000000010734f34b __exceptionPreprocess + 171
  1   libobjc.A.dylib                     0x0000000106db021e objc_exception_throw + 48
  2   CoreFoundation                      0x0000000107353442 +[NSException raise:format:arguments:] + 98
  3   Foundation                          0x0000000103d41edd -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
  4   UIKit                               0x00000001041ccbe9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3827
  5   UIKit                               0x00000001041c9539 -[UIApplication workspaceDidEndTransaction:] + 188
  6   FrontBoardServices                  0x000000010904a76b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
  7   FrontBoardServices                  0x000000010904a5e4 -[FBSSerialQueue _performNext] + 189
  8   FrontBoardServices                  0x000000010904a96d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
  9   CoreFoundation                      0x00000001072f4311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
  10  CoreFoundation                      0x00000001072d959c __CFRunLoopDoSources0 + 556
  11  CoreFoundation                      0x00000001072d8a86 __CFRunLoopRun + 918
  12  CoreFoundation                      0x00000001072d8494 CFRunLoopRunSpecific + 420
  13  UIKit                               0x00000001041c7db6 -[UIApplication _run] + 434
  14  UIKit                               0x00000001041cdf34 UIApplicationMain + 159
  15  ApologiaBiologyFlashcards           0x0000000103ba9a11 main + 65
  16  libdyld.dylib                       0x00000001088ba68d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)


The AppDelegate.m looks like this:


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSLog (@"%s", __PRETTY_FUNCTION__);
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    HomePageViewController * homeviewController = [[HomePageViewController alloc] initWithNibName:@"HomePageViewController" bundle:nil];
    self.window.rootViewController = homeviewController;
    [self.window makeKeyAndVisible];
    return YES;
}


Any assistance would be greatly appreciated.

Thank you in advance.

Go to the MainWindow.xib and check to be sure your Window rootviewcontroller is connected to the appropriate viewController. I think this will solve your problem. Cheers.

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