This question is an extension to: Taking Screenshots from iOS app - emulating Display recorder (query on the internals)
There are 2 ways I came across to take screenshots from the background -
1. Creating an image out of the ios surface and saving it - it captures at a very fast rate (approximately 0.2-0.3 sec/ 12-15 screenshots), however there are some problems that are encountered, discussed here: Releasing an IOSurface
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 rate is very bad, approximately 0.5-0.7 sec/screenshot.
So, is there a solution to the problem faced in approach 1 ?
Is there a way to improve performance for approach 2 ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…