This question is an extension: Taking screenshots from an iOS application - emulation Display recorder (request for internal components)
There are two ways I came across to take screenshots from the background -
1. Creating an image from the ios surface and saving it - it is captured at a very high speed (approximately 0.2-0.3 sec / 12-15 screen shots), however there are some problems that are encountered here: IOSurface liberation
2. The following code does the same job using the createScreenIOSurface API:
IOSurfaceRef surface = [UIWindow createScreenIOSurface]; UIImage *surfaceImage = [[UIImage alloc] _initWithIOSurface:surface orientation:UIImageOrientationUp]; CFRelease(surface); UIImageSaveToPhotosAlbum(surfaceImage, self, nil, nil);
However, the capture speed is very poor, about 0.5-0.7 seconds / screen shot.
So, is there a solution to the problem in approach 1?
Is there a way to improve performance for approach 2?
source share