应用程序应该有一个根视图控制器控制台 [英] applications expected to have a root view controller console

查看:29
本文介绍了应用程序应该有一个根视图控制器控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行我的应用程序时,我在控制台中收到一条消息:

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] 应用程序应该在应用程序启动结束时有一个根视图控制器

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

我从其他人那里听说这与 didFinishLaunchingWithOptions

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.

我的方法代码:

- (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;
}

推荐答案

你应该替换

[window addSubview:tabBarController.view];

[self.window setRootViewController:tabBarController];

也许您使用Empty Application"构建了您的项目,而忘记在您的 didFinishLaunchingWithOptions(存在于您的 >AppDelegate.m).

Maybe you built your project with 'Empty Application' and forgot to set the rootViewController in your didFinishLaunchingWithOptions (which exists in your AppDelegate.m).

但是,如果您使用单视图应用程序"或其他类型构建项目,该项目将通过 xib 设置 rootViewController默认情况下(可能是您项目中的 MainWindow.xib).

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆