I’m trying to build a simple tweak in objective-c that will take a screenshot when the device is shaken. I’ve gotten half the thing working since I tested the tweak to send an alert when the device is shaken, but I’d like it to take a screenshot instead but I can’t seem to find the proper code.
Here’s the code I have right now:
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if(event.subtype == UIEventSubtypeMotionShake && self == [[UIApplication sharedApplication] keyWindow]) {
/// Screenshot action should go here. I’ve tried multiple methods but none works.
}
}
I’ve tried many methods and hooks but nothing worked for the screenshot. I would really appreciate some help!