gpt4 book ai didi

ios - 错误 : Application windows are expected to have a root view controller at the end of application launch

转载 作者:行者123 更新时间:2023-11-29 00:57:42 28 4
gpt4 key购买 nike

我正在尝试更新 6 年前使用 OpenGL ESObjective C 编写的 iOS 应用程序。

按原样运行应用程序时,出现此错误:

4DRoom_v3[2360:42863] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'

根据我读到的内容here我需要设置 Root View Controller 。

我在这里添加 subview :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

[MeshViewAppDelegate globalVarInit];

//sleep(1);
glView.multipleTouchEnabled = TRUE;
load4Dice();//(str, NEW);

[window addSubview:glView];
//[window makeKeyAndVisible];
glView.animationFrameInterval = 1.0/40;
printf("finish luanching\n");
//[glView startAnimation];

return YES;
}

glView是UIView的子类。但我不知道如何实现给出的解决方案,因为在这种情况下, View 不是 UIViewController 的属性。

我不清楚我可以将哪个 UIViewController 设置为 Root View Controller 。

如有任何帮助,我们将不胜感激。

最佳答案

创建一个 View Controller 并将你的 glview 添加为 subview :

UIViewController* vc = [[UIViewController alloc]initWithNibName:nil bundle:nil];
[vc.view addSubview:glview];
window.rootViewController = vc;

关于ios - 错误 : Application windows are expected to have a root view controller at the end of application launch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37457038/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com