title: presentViewController causing crash
body: <p>I'm working on an iPad app using cocos2d, and I'm trying to make it possible to either choose a picture from the library, or take a picture using the camera, to use within the app. I've been googling like mad all day yesterday and today to try and fudge together something to do the above, but I should probably begin by admitting that I don't really know what I'm doing.</p>
  
  <p>The way I have it working right now, you tap the current user image, and it brings up a menu asking if you want to upload a different picture from the camera or the library. Choosing camera calls the following (and the library version is basically the same):</p>
  
  <pre><code>- (void) onGetCameraImage
  {
      UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
      imagePicker.delegate = self;
      imagePicker.allowsEditing = NO;
  
      imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
      [imagePicker presentViewController:[CCDirector sharedDirector] animated:YES completion:NULL];
  }
  </code></pre>
  
  <p>When I try and test this (picking library, of course, since the simulator can't do camera, and yes I do intend to implement the check for no camera), I get the following crash:</p>
  
  <pre><code>2013-04-07 19:21:50.248 prototype1[20897:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller &lt;UIImagePickerController: 0x9e87ac0&gt;.'
  </code></pre>
  
  <p>I think it's crashing on the <code>presentViewController</code> call, but I'm having a terrible time trying to find out what I'm doing wrong because all of the tutorials and stackoverflow answers use the deprecated modal function call! I suspect I'm just doing all sorts of crazy BS in my previous code? Either way, I have no idea how to get my code to work.</p>
  
  <p>A lot of this code has been gleaned from stack overflow, so I can't guarantee the sensibility of any of it - I'm very new to iOS coding, was basically thrown into this project and we're just trying to make it work. Please help!</p>