25

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.

God of Biscuits
  • 1,312
  • 1
  • 13
  • 27
  • You could watermark all the pictures all the time. Watermarks don't have to be human percievable. – Rhythmic Fistman Jan 23 '10 at 10:11
  • Yes, I know we could go that route, but the idea would be to *visually* interfere with the image. – God of Biscuits Jan 24 '10 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? – conorgriffin Jan 26 '10 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. – machine elf Jan 27 '10 at 05:57
  • Try what this answer does (second one) http://stackoverflow.com/questions/10122212/iphone-screenshot You can "technically" monitor for a user picture appearing in the library. – Pochi Nov 21 '12 at 00:52
  • Just a note to keep in mind, folks, since iOS 7: there is a screenshotting API that's a TON faster for programmatically creating screen shots. This doesn't help with the question, but there you have it. – God of Biscuits Jun 27 '15 at 10:43
  • @GodofBiscuits did you found any solution? i also want same functionality in one of my application.as i have checked many application have similar functionality like Confide,blackBox game. – Bhavesh.iosDev Jan 22 '19 at 06:53
  • Is there any way to detect captured image in the observer and we can make it obscured? – Sunil Targe Feb 22 '19 at 02:56

4 Answers4

7

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.)

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
  • Docs for Darwin Notifications: http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Conceptual/MacOSXNotifcationOv/DarwinNotificationConcepts/DarwinNotificationConcepts.html – Dimitris Jan 24 '10 at 01: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) – God of Biscuits Jan 24 '10 at 22:57
  • 11
    Just for reference, this functionality has been lost since iOS 4.0. – Alexander Kellett Jun 14 '10 at 15:03
7

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.

conorgriffin
  • 4,282
  • 7
  • 51
  • 88
  • 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. – God of Biscuits Jan 27 '10 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. – Stephen Siu Feb 03 '14 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];
}
txulu
  • 1,602
  • 16
  • 26
  • 7
    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 – God of Biscuits Nov 13 '14 at 03:01
  • How to remove the image after users take the screen shoot? – lee Jun 18 '15 at 07:25
  • Also cannot be done, you cannot programmatically remove the last image from the roll, not even if you have camera access – txulu Aug 10 '16 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 Apr 21 '17 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 Apr 24 '17 at 15:35
  • @Carol But a way of checking what you want would be to ask on appDidBecomeActive or something for access to the pics of the user's camera roll and check if those are screenshots, if they are recent, etc. – txulu Apr 24 '17 at 15:38
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.

God of Biscuits
  • 1,312
  • 1
  • 13
  • 27