如何解决ios程序在ios5下出现黑屏的问题

这篇文章给大家分享的是有关如何解决ios程序在ios5下出现黑屏的问题的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

 用xcode4.2生成的程序是可以在ios5.1和ios6上运行的,但是在ios5下黑屏:

报错信息为:

2013-01-16 19:03:55.969 HelloCoco2d[5934:c07] Applications are expected to have a root view controller at the end of application launch

经查询原因是ios5.1以上默认使用RootViewController,而在ios5以下默认不使用RootViewController

需要在AppDelegate手动添加代码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {   self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];     self.rootViewController=[[RootViewController alloc]init];   self.window.rootViewController =self.rootViewController;   [self.window makeKeyAndVisible];   return YES; }

感谢各位的阅读!关于“如何解决ios程序在ios5下出现黑屏的问题”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!