I have an existing iPhone app that was working fine in Xcode 4.0 prior to upgrading to Xcode 4.5. Upon upgrading, now I get a Black Screen when running in the iPhone/iPad 4.3 Simulator and get the following Exception when running the iPhone/iPad 6.0 Simulator.
Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <CCGLView: 0x8c7f380; frame = (0 0; 320 480); layer = <CAEAGLLayer: 0x8c7f670>> is associated with <CCDirectorDisplayLink = 0x994c7f0 | Size: 320 x 480, view = <CCGLView: 0x8c7f380; frame = (0 0; 320 480); layer = <CAEAGLLayer: 0x8c7f670>>>. Clear this association before associating this view with <RootViewController: 0x8c7ef00>.'
The app is using Cocos2D 2.0, and is pretty simple based on a tutorial found online. There is no XIB file. Everything is being done programmatically.
These are the lines that cause the exception in the 6.0 Simulator (from IOS6TestAppDelegate.m):
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
[enter link description here][1]viewController.wantsFullScreenLayout = YES;
If these lines are commented out, then the 6.0 Simulator shows a black screen as well, instead of the regular menu screen.
I’ve searched online for solutions on this and tried a number of things, but have been unable to make progress. I’m fairly new to iPhone programming (though am not new to programming in general) and am really struggling with this. I would really appreciate any help.
First, delete
Then replace
With
That should do it!