当我构建我的应用程序时,它编译时没有任何问题或错误。但当我运行它时,我在控制台中看到以下消息:
Application windows are expected to have a root view controller at the end of application launch.下面是我的Appdelegate的方法,我认为它可能会导致这种情况(基于我在SO上看到的其他帖子)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
PhotosViewController *viewController = [[PhotosViewController alloc] initWithNibName:nil bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
[self.window addSubview:self.navigationController.view];
[self.window makeKeyAndVisible];
return YES;这是我需要担心的事情吗?我的应用程序在模拟器中运行,即使显示此消息。
我该怎么做才能摆脱它,有什么建议吗?我能做些什么来调试它?
顺便说一句,我在SO上看到了其他问题,也有类似的错误信息,但是,没有一个场景适用于我的问题,所以我发布了这个问题。它不是重复的:)
谢谢
发布于 2012-09-10 11:15:26
而不是:
[self.window addSubview:self.navigationController.view];使用:
self.window.rootViewController = self.navigationController;您可以在UIWindow documentation中找到更多详细信息
https://stackoverflow.com/questions/12344950
复制相似问题