27

Is there a notification or other mechanism of being informed that the user is taking a screenshot with the home/power buttons?

I've seen threads about wanting to disable the taking of screenshots, but that's not what I'm looking to do.

I have a photographer client who's concerned that his works will be copied by means of users taking screenshots and I thought that if there was an opportunity to put a watermark across the image before the screenshot was taken, that would allay his fears.

8
  • You could watermark all the pictures all the time. Watermarks don't have to be human percievable. Commented Jan 23, 2010 at 10:11
  • Yes, I know we could go that route, but the idea would be to visually interfere with the image. Commented Jan 24, 2010 at 22:46
  • What is the purpose of this notification you're looking for? I mean, who would you inform, and what could they do with that info? Is this on the web or within a closed network on mobile safari? Or within a specific application? Commented Jan 26, 2010 at 21:06
  • 2
    I wonder if Flash could toggle 2 interlaced images continually (with acceptable overall performance)? That would visually degrade a screen shot. Commented Jan 27, 2010 at 5:57
  • Try what this answer does (second one) stackoverflow.com/questions/10122212/iphone-screenshot You can "technically" monitor for a user picture appearing in the library.
    – Pochi
    Commented Nov 21, 2012 at 0:52

4 Answers 4

8

The PictureWasTakenNotification Darwin notification will be sent when the user takes a screenshot. However, this is sent after the screenshot is taken.

(No notifications will be sent before the screenshot was taken.)

3
  • Docs for Darwin Notifications: developer.apple.com/mac/library/DOCUMENTATION/Darwin/Conceptual/…
    – Dimitris
    Commented Jan 24, 2010 at 1:50
  • Neither that notification nor CameraImageFullSizeImageReadyNotification seems to be in the iPhone SDK. Regardless, as you point out, it's not ideal for me that it gets fired off after the screenshot is taken (as both notifications are) Commented Jan 24, 2010 at 22:57
  • 11
    Just for reference, this functionality has been lost since iOS 4.0. Commented Jun 14, 2010 at 15:03
8

Here's a way which might work, although it will totally go against user interface guidelines I'm sure. If you force the user to have their finger on the screen for the image to show then I don't think they can create screenshots. Because as soon as you press the home+lock keys to actually take the screenshot, the screen seems to behave as if there are no fingers touching it. Try taking a screenshot while moving between home screens to see what I mean.

Not a perfect solution by any means but you may be able to work it into your app design if you're really clever without it detracting too much from the user experience (a tough challenge though!). Nevertheless, I believe this may allow you to display artwork/photos without allowing users to take screenshots.

2
  • I thought of this and tried it with iphone.appleinsider.com, whose bizarre interface shows UI chrome when you're NOT touching the screen. While holding down a finger on the screen (so the Webview was tracking the touch) I took a screenshot, and you're right, the screenshot took the shot as if the app was not tracking a touch. Still, I strongly believe that interfering with the OS Feature is tantamount to disabling it. But I suppose I should report back to my client about it. Commented Jan 27, 2010 at 18:20
  • 1
    They disabled that effect in iOS 7 whereby it continues to act like your finger is on the screen when taking the screenshot. This is a la SnapChat functionality. Commented Feb 3, 2014 at 20:27
3

Since iOS 7 the UIApplicationUserDidTakeScreenshotNotification exists. So doing something like this should detect the screenshots:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDidTakeScreenshot) name:UIApplicationUserDidTakeScreenshotNotification object:nil];
}

- (void)userDidTakeScreenshot {
    // Screenshot taken, act accordingly.
}

Finally, don't forget to remove the observer:

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationUserDidTakeScreenshotNotification object:nil];
}
6
  • 10
    What is actually needed is something that would fire off the notification BEFORE the shot is taken. In other words, the "...UserWillTake..." version of that notification Commented Nov 13, 2014 at 3:01
  • How to remove the image after users take the screen shoot?
    – lee
    Commented Jun 18, 2015 at 7:25
  • Also cannot be done, you cannot programmatically remove the last image from the roll, not even if you have camera access
    – txulu
    Commented Aug 10, 2016 at 12:28
  • @txulu Do you know if UIApplicationUserDidTakeScreenshotNotification work in background mode? or if exists any way to detect screenshots in background mode?
    – Carolina
    Commented Apr 21, 2017 at 22:02
  • @Carol I don't know for sure, didn't check, but this is just a normal NSNotification posted by the system so I guess that as long as your process is executing you will get it (for example, after going to background you usually have some 20 seconds execution time then the system shuts you down; but you can also have one of the special background modes where you execute code all the time). (Short answer: no, it won't work).
    – txulu
    Commented Apr 24, 2017 at 15:35
1

What's really needed is a notification that is sent before the actual screen capture happens. A delegate method or some other means of giving the app a screenshotting-in-flight opportunity to redraw your content before the grab happens.

And there isn't one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.