“Application windows are expected to have a root view controller at the end of application launch” error only on iPad

Change the following line:

[_window addSubview:[_navigationController view]];

to:

_window.rootViewController = _navigationController;

or, if you need iOS 3 compatibility:

if ([_window respondsToSelector:@selector(setRootViewController:)]) {
    _window.rootViewController = _navigationController;
} else {
    [_window addSubview:_navigationController.view];
}

Leave a Comment