应用程序在应用程序启动结束时应具有根视图控制器 [英] Applications are expected to have a root view controller at the end of application launch

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

问题描述

我在控制台中收到以下错误:

I get the following error in my console:


应用程序在应用程序启动结束时应该有一个根视图控制器

Applications are expected to have a root view controller at the end of application launch

以下是我的应用程序:didFinishLaunchWithOptions 方法:

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

在Interface Builder中, UITabBarController 的代表与App Delegate联系在一起。

In Interface Builder, the UITabBarController's delegate is hooked up to the App Delegate.

任何人都知道如何解决这个问题?

Anyone know how to fix this issue?

推荐答案

替换为AppDelegate

Replace in AppDelegate

 [window addSubview:[someController view]];

  [self.window setRootViewController:someController];

这篇关于应用程序在应用程序启动结束时应具有根视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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