Reputation: 13
I'm trying to update an iOS app written 6 years ago using OpenGL
ES
and Objective C
.
When running the app as it is, I get this error:
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'
From what I have read here I need to set the root view controller.
I add the subview here:
- (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 is a subclass of UIView. But I don't see how to implement the solution given since in this case, the view is not a property of a UIViewController.
It isn't clear to me what UIViewController I could set as the root view controller.
Any help would be greatly appreciated.
Upvotes: 0
Views: 2309
Reputation: 1235
Create a view controller and add your glview as subview:
UIViewController* vc = [[UIViewController alloc]initWithNibName:nil bundle:nil];
[vc.view addSubview:glview];
window.rootViewController = vc;
Upvotes: 1