title: iOS: Is it possible to take screenshots while running as a background task?
body: <p>I want to take screenshots of any running app, while my app is in the background.</p>
  
  <p>I know I can take screenshots in iOS using:</p>
  
  <pre><code>UIGraphicsBeginImageContext(webview.frame.size);
  [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
  UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
  </code></pre>
  
  <p>But this is not really possible in a background task as UIGraphicsGetCurrentContext returns NULL and I want a screenshot of the running app and not my view. Is there any other way?</p>