Search code examples
iosobjective-cipadscreenshot

How to take Screen Shot of iPad Home screen programatically?


i tried below code but it take only apps background screenshot, not iPad home screenshot...

CGImageRef screen = UIGetScreenImage();
UIImage* image = [UIImage imageWithCGImage:screen];
CGImageRelease(screen);
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);

Solution

  • You can't take an image of the home screen from within your app. This would violate the sandbox principle.