应用程序需要有一个根视图控制台控制台 [英] applications expected to have a root view controller console
问题描述
当我运行我的应用程序时,我在控制台中收到一条消息:
2011-11-16 19:17: 41.292 Juice [8674:707]应用程序启动结束时应该有一个根视图控制器
这与这个方法 didFinishLaunchingWithOptions
如果任何人有任何建议为什么我得到这个错误,非常感谢。
我的方法代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//应用程序启动后覆盖自定义点。
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
return YES;
}
p>
[window addSubview:tabBarController.view];
到
[self.window setRootViewController:tabBarController];
也许您是使用空应用程序建立项目并忘记设置 didFinishLaunchingWithOptions
(存在于 AppDelegate.m 中)中的 rootViewController
。
但是,如果您使用 Single View Application 或其他类型构建项目,项目将设置 MainWindow.xib ),通过 > rootViewController
I am getting a message within the console when I run my app that says:
2011-11-16 19:17:41.292 Juice[8674:707] Applications are expected to have a root view controller at the end of application launch
I have heard from others that this has to do with the method didFinishLaunchingWithOptions
If anyone has any suggestions for why I am getting this error, it would be much appreciated.
My code for the method:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
return YES;
}
You should replace the
[window addSubview:tabBarController.view];
to
[self.window setRootViewController:tabBarController];
Maybe you built your project with 'Empty Application' and forgot to set the rootViewController
in your didFinishLaunchingWithOptions
(which exists in your AppDelegate.m).
However, if you build your project with 'Single View Application' or some other type, the project will set the rootViewController
via xib
by default (which might be a MainWindow.xib in your project).
这篇关于应用程序需要有一个根视图控制台控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!