I've seen a number of posts on UIGetScreenImage, however, not a complete working (short) code example.
If anyone has a code example, from the prototype definition to an actual call, that would be greatly appreciated.
CGImageRef UIGetScreenImage(void);
....
CGImageRef screen = UIGetScreenImage();
UIImage* screenImage = [UIImage imageWithCGImage:screen];
CGImageRelease(screen); // you need to call this.
// UIGetScreenImage violates the CF memory management rules.
// Use screenImage as you like.
Recently I needed to integrate taking screenshots into my iOS app. This question comes up pretty high in the search list on StackOverflow. However, since the initial public release of this method, Apple has made UIGetScreenImage
private and any call to it will get your app rejected.
Apple made this post on their official forum regarding replacing calls to UIGetScreenImage
.
Programmatic screenshots are no longer as simple as they use to be and there are now different ways to take a screenshot depending on the type of image that needs to be acquired.
The above Apple forum post explains how to take an image in each context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With