title: IOS 5 - Cocos2d and UIKit push and pop UIView causing "failed to call context"
body: <p>I have a completely working cocos2d game.  I thought it would be nice to add a simple little welcome screen before playing the game.  </p>
  
  <p><em><strong></em>*NOTE this only occurs when running on an iPad device, never, in the simulator***</strong></p>
  
  <p>Before the addition of the welcome screen the basic navigation/code flow was</p>
  
  <blockquote>
    <blockquote>
      <p>MainWindow.xib (containing a navigation controller with RootViewController)
      RootViewController adds an EAGLView as a full-screen child.</p>
    </blockquote>
  </blockquote>
  
  <p>The RootViewController.xib contains a UIKit button to present a "preferences" page allowing users to change game parameters.  When finished the preferences page is popped view the standard navigation "back" button to the game screen.</p>
  
  <p>This all works wonderfully.</p>
  
  <p>As I have it now, The RootViewController loads the creates the WelcomeViewController and then pushes it onto navigation stack.  This page is popped when the user presses a "play" button.</p>
  
  <p>Once again, all of this works just fine... until...</p>
  
  <p>Control is returned to the RootViewController and the cocos2d scene.  During the initialization code handling for viewWillAppear, the cocos2d code eventually comes to the function "resizeFromLayer".  The "layer" parameter hasn't changed and according to the debugger is of the correct type, as is the variable "context_".  However after the call to </p>
  
  <p>context_ renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:layer]</p>
  
  <p>the CCLog error "failed to call context" is issued.  </p>
  
  <p>Later the errors: 
  "Failed to make complete framebuffer object"
  followed by an unending stream of:
  OpenGL error 0x0506 in -[EAGLView swapBuffers]</p>
  
  <p>If I comment out the code to show the welcome screen, none of this occurs.  </p>
  
  <p>What could be happening, and where should I look to resolve this issue when I return to a cocos2d scene after a UIKit navigationcontroller has been popped?</p>
  
  <p>Thanks in advance!</p>