title: How To Use AVCaptureStillImageOutput To Take Picture
body: <p>I have a preview layer that is pulling from the camera and working as it should. I would like to be able to take a picture when I press a button. I have inited the AVCaptureStillImageOutput like this:</p>
  
  <pre><code>AVCaptureStillImageOutput *avCaptureImg = [[AVCaptureStillImageOutput alloc] init];
  </code></pre>
  
  <p>Then I am trying to take a picture using this object:</p>
  
  <pre><code>[avCaptureImg captureStillImageAsynchronouslyFromConnection:(AVCaptureConnection *) completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {  }];
  </code></pre>
  
  <p>I need help on how to take a picture and save it in a variable. Thanks</p>