title: UIImagePicker crashes on ios7/iphone 4s
body: <p>I have an app which uses the UIImagePickerController to allow the user to take photos.</p>
  
  <p>I have reduced the test case to the simplest sequence in a single view controller app. Here is my code. </p>
  
  <pre><code>//
  //  CTViewController.h
  //  Camera Test
  //
  
  #import &lt;UIKit/UIKit.h&gt;
  
  @interface CTViewController : UIViewController &lt;UINavigationControllerDelegate,   UIImagePickerControllerDelegate&gt;
  
  @property (nonatomic, retain) UIImagePickerController *cameraController;
  
  - (IBAction)takePicture:(id)sender;
  
  @end
  </code></pre>
  
  <p>the body of the code is as follows:</p>
  
  <pre><code>//
  //  CTViewController.m
  //  Camera Test
  
  #import "CTViewController.h"
  
  ....
  
  - (void)didReceiveMemoryWarning
  {
      NSLog(@"%s", __func__);
  
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  - (IBAction)takePicture:(id)sender
  {
      self.cameraController = [[UIImagePickerController alloc] init];
  
      self.cameraController.sourceType = UIImagePickerControllerSourceTypeCamera;
      self.cameraController.allowsEditing = YES;
      self.cameraController.delegate = self;
      [self presentViewController:self.cameraController animated:YES completion:nil];
  }
  </code></pre>
  
  <p>'takePicture' is hooked up to a button I can press in the middle of the screen.</p>
  
  <p>On ios 6 everything works perfectly, but on ios 7 I get a cascade of memory warnings once the viewcontroller is presented. Thus:</p>
  
  <pre><code>Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
  Received memory warning.
  -[CTViewController didReceiveMemoryWarning]
  
  .... &lt;here I take a picture, which I do nothing with&gt;
  
  Received memory warning.
  -[CTViewController didReceiveMemoryWarning]
  Received memory warning.
  -[CTViewController didReceiveMemoryWarning]
  
  .... &lt;I get a cascade of these warnings&gt;
  </code></pre>
  
  <p>The app is built using the ios 7.0 sdk using xcode 5. The same problem occurs if I build with the ios 6.1 sdk, but run on ios7. Building with the ios 6.1 sdk and running on ios 6.1.3 causes no messages and no problems.</p>
  
  <p>My complete app crashes 50% of the time on ios 7. I respond to the memory warning by throwing a lot of stuff (images mostly) out of memory and profiling confirms this, but I still get the cascade of warnings (i.e. they continue after the memory is freed).</p>
  
  <p>If I use the front camera, choose from the gallery or use an iPad 3, there are no messages. I therefore suspect that the memory problem is associated with the size of the UIImagePickerController when the rear camera is used.</p>
  
  <p>I have fully explored stackoverflow and have looked particularly at this post - <a href="https://stackoverflow.com/questions/18890003/uiimagepicker-get-error-snapshotting-a-view-that-has-not-been-rendered-results">UIImagePickerController error: Snapshotting a view that has not been rendered results in an empty snapshot in iOS 7</a> </p>
  
  <p>I have tried everything suggested, but my simple test app precludes most of the explanations.</p>
  
  <p>Any thoughts? Should I abandon support for the iPhone 4S? I have no yet confirmed the problem on the iPhone 5, but I will update this question as soon as I have.</p>
  
  <p>:-)</p>