3

I need to make an app which can keep running and taking screenshots from background every second or video recording of the screen. As iOS apps runs in the sandbox is it possible to make it.

Note: This app is for internal purpose. Not going to post in app store.

MD Aslam Ansari
  • 1,565
  • 11
  • 19

1 Answers1

0

If you want to take a screenshot below method can you returning an image:

-(UIImage *) takeScreenshot{
    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, 0);
    [self.view drawViewHierarchyInRect:self.view.bounds afterScreenUpdates:YES];
    UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return screenshot;
}
iYoung
  • 3,596
  • 3
  • 32
  • 59
  • I know how to take the screenshot with code. But the thing I want is it should keep running from background what ever I am doing in the phone it should capture those. – MD Aslam Ansari May 07 '16 at 06:24
  • Not a big problem create an `NSTimer` with an interval of 1 sec & call this method, & if you want the process to work in background as well then execute a background process as well. – iYoung May 07 '16 at 08:48
  • @iYoung Can you confirm this method works? calling UIGraphicsGetImageFromCurrentImageContext will throw a "can't call this method from background" exception – yonez Nov 21 '17 at 08:12