In iOS, we receive a callback event when a user takes a screenshot. This is achieved by listening to the
"UIApplicationUserDidTakeScreenshotNotification" event. Is there a similar event callback available for macOS?
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationUserDidTakeScreenshotNotification
object:nil
queue:mainQueue
usingBlock:^(NSNotification *note) {
// executes after screenshot
NSLog(@"Screenshot Detection : %@", note);
UIAlertView *screenshotAlert = [[UIAlertView alloc] initWithTitle:@"Screenshot Detected" message:@"Oh Oh no screenshot bruhh" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[screenshotAlert show];
}];