I'm trying to take screenshot of the whole screen from a command line tool compiled with THEOS. I've tried all the Private APIs UICreateScreenImage, UIGetScreenImage and _UICreateScreenUIImage, all return a black or empty image (but the size of the picture is correct)
This is my code that use the "_UICreateScreenUIImage" API:
extern "C" UIImage* _UICreateScreenUIImage();
int main(int argc, char **argv, char **envp) {
UIImage* screenImage = _UICreateScreenUIImage();
[UIImagePNGRepresentation(screenImage) writeToFile:@"/var/mobile/screenshot.png" atomically:YES];
[screenImage release];
return 0;
}
I've linked the frameworks: Foundation UIKit QuartzCore CoreGraphics and GraphicsServices as private framework. I can't use the Apple way described here Why does my programmatically created screenshot look so bad on iOS 7? because is a command line tool. Any suggestions?