title: Take a screenshot of an UIView where its subviews are camera sessions
body: <p>I'm building an app where I need to take a screenshot of a view whose subviews are camera sessions (AVFoundation sessions). I've tried this code:</p>
  
  <pre><code>CGRect rect = [self.containerView bounds];
  UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f);
  CGContextRef context = UIGraphicsGetCurrentContext();
  [self.containerView.layer renderInContext:context];
  UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  </code></pre>
  
  <p>Which effectively gets me an UIImage with the views, only that the camera sessions are black:</p>
  
  <p><img src="https://i.stack.imgur.com/nwStO.png" alt="enter image description here"></p>
  
  <p>I've tried the private method <code>UIGetScreenImage()</code> and works perfectly, but as Apple doesn't allows this, I can't use it. I've also tried the one in <a href="http://developer.apple.com/library/ios/#qa/qa1703/_index.html">Apple's docs</a> but it's the same. I've tracked the problem to AVFoundation sessions using layers. How can I achieve this? The app has a container view with two views which are stopped camera sessions.</p>