gpt4 book ai didi

objective-c - 转换为 ARC 后的 Root View Controller 警告

转载 作者:行者123 更新时间:2023-11-29 11:18:02 25 4
gpt4 key购买 nike

我正在将我的 opengl 游戏转换为 ARC,并在应用启动时遇到此错误/警告消息:

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

我没有使用 nib 或 xib 文件来创建我的 View 或窗口。在非 arc 代码中一切正常(现在已经有几年了)。

出现错误/警告后,游戏继续运行并且运行良好,但我想知道是什么原因造成的,因为它可能会在以后造成问题。

我的猜测是,由于它是弧形的,因此没有正确保留某些内容,但我无法弄清楚是什么。有任何想法吗?以下是我创建 opengl View 和窗口的方式。

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
[window setUserInteractionEnabled:YES];
[window setMultipleTouchEnabled:YES];

glView = [[EAGLView alloc] initWithFrame:[UIScreen mainScreen].bounds];

[window addSubview:glView];
[window makeKeyAndVisible];

[glView performSelectorOnMainThread:@selector(startMainGameLoop) withObject:nil waitUntilDone:NO];

return YES;
}

和...

@interface GameAppDelegate : NSObject <UIApplicationDelegate> 
{
UIWindow *window;
EAGLView *glView;
}

最佳答案

应用程序应该在应用程序启动结束时有一个 Root View Controller 。”消息正在弹出,提示许多人没有在 iOS5 中的应用程序委托(delegate)的窗口属性上设置 rootViewController 属性代码 4.2。 (不依赖于 ARC)

A question on why this message shows up has been posted here .

现在看来是一个友好的警告。尽管普遍的感觉是它将成为规则。

在 Xcode 中查看“OpenGL 游戏”的项目模板可能是值得的。这似乎是苹果希望所有应用程序结构化的方式。

关于objective-c - 转换为 ARC 后的 Root View Controller 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8553318/

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