用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;
- }
本文转自yifangyou 51CTO博客,原文链接:http://blog.51cto.com/yifangyou/1123538,如需转载请自行联系原作者