title: iOS app with Camera crashes ONLY when connected to Instruments
body: <p>Our commercial app is crashing while testing it with Automation scripts in Instruments. We narrowed down the issue to the UIImagePickerController.
  But it only crashed while connected to Instruments!</p>
  
  <p>To narrow down the problem we created a bare bones Tester app that does only one thing: bring up the Camera Picker then dismiss it.</p>
  
  <p>The steps to reproduce are 
  1. click Button to bring up camera
  2. Dismiss Camera by clicking Cancel
  3. Repeat 40-50 times.</p>
  
  <p>Running on a device there is no problem after over 100 repetitions
  Connecting to Instruments it crashes reliably after 40-50 repetitions.</p>
  
  <p>The Tester app has a single view that has a UIButton inside view controller.
  When clicking the button, it presents a UIImagePickerController from the view controller, like so:</p>
  
  <pre><code>-(IBAction)buttonClicked:(id)sender
  {
      imagePicker = [[UIImagePickerController alloc] init];
      imagePicker.delegate = self;
      imagePicker.modalPresentationStyle = UIModalPresentationFullScreen;
  
      imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
      imagePicker.showsCameraControls = TRUE;
  
      [self presentViewController:imagePicker animated:YES completion:^{}];
  
  }
  </code></pre>
  
  <p>This is the declaration of the view controller:</p>
  
  <pre><code>@interface ViewController : UIViewController&lt;UINavigationControllerDelegate,UIImagePickerControllerDelegate&gt;
  {
      UIImagePickerController *imagePicker;
  }
  </code></pre>
  
  <p>After the UIImagePickerController is launched, simply press the Cancel button to exit out of the UIImagePickerController, and the delegate method looks like this:</p>
  
  <pre><code>- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
  {
      [self dismissViewControllerAnimated:YES completion:^{
          NSLog(@"Cancel Picker");
      }];
  }
  </code></pre>
  
  <p>Any help will be appreciated.</p>