Why does my application crash every time I try to show two child view controllers that are GLKViewControllers?

Example project: http://d.pr/f/v7zD

I'm trying to build an app that would show two GLKViewControllers. I'm using Storyboards, so I have my main view controller (the initial one) with two container views in it that branch off into two UIViewControllers that have a custom class of OpenGLViewController (which is just a subclass of GLKViewController I've created).

The views within those two child view controllers are GLKViews.

Yet, every time I run it I get this error as soon as it launches:

* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[GLKViewController loadView] loaded the "BYZ-38-t0r-view-8bC-Xf-vdC" nib but didn't get a GLKView.'

How do I make this work? I'm pulling my hair out.

Answers


Is your view IB outlet correctly set?

It can be that your GLKViewController subclass, is not able to find the expected outlet to a GLKView.

I managed to fix your project. You can download it here. Basically, the view outlets were incorrectly set and the initial view controller class was wrongly set in IB. I also set the delegates. Check out the screenshots.

Hope it helps.


Need Your Help

ListView.ItemContainerGenerator.ContainerFromItem(item) return null after 20 items

wpf listview wpf-controls

first of all I want to explain what I'm trying to do. I have a ListView in a UserControl with a DataTemplate defined as a resource. I want to hide a button inside the DataTemplate. Sounds easy, but...

Windows Phone app calls MapUri() twice when I call NavigateService.Navigate()

c# map windows-phone uri navigateuri

I recently added a custom UriMapper for saving files into my applications isolated storage when opening them from IE. The code for this looks like this: