Tuesday, June 21, 2016

Objective C detect screenshot

If our app is displaying delicate/private data where user is not allowed to download our files, Users may go for taking the screenshot of that file. We may need to know whether there is any screenshot taken from our iOS app. This feature is available in some chat applications available in market today. When user takes the screenshot of the sent pic from another user, the other user will get notified of this.

We have a notification which was introduced in iOS7 which is posted after user takes a screenshot.

That is UIApplicationUserDidTakeScreenshotNotification.

In your ViewController, Where you display your private data, You can observe for this notification.

  [[NSNotificationCenter defaultCenteraddObserver:self 


Hope this post is useful. Feel free to comment in case of any queries.