Applications are expected to have a root view controller at the end of application launch(应用程序在应用程序启动结束时应该有一个根视图控制器)
问题描述
I get the following error in my console:
Applications are expected to have a root view controller at the end of application launch
Below is my application:didFinishLaunchWithOptions
method:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Set Background Color/Pattern
self.window.backgroundColor = [UIColor blackColor];
self.tabBarController.tabBar.backgroundColor = [UIColor clearColor];
//self.window.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"testbg.png"]];
// Set StatusBar Color
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
// Add the tab bar controller's current view as a subview of the window
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
In Interface Builder, the UITabBarController
's delegate is hooked up to the App Delegate.
Anyone know how to fix this issue?
Replace in AppDelegate
[window addSubview:[someController view]];
to
[self.window setRootViewController:someController];
这篇关于应用程序在应用程序启动结束时应该有一个根视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!