How do we prevent a user from taking screenshot ?


I would be surprised if you can disable it. Snapchat requires that you be touching the screen to display the image - that prevents screenshots. Another thing you might be able to do is display the screen in quick shots of partial images, perhaps interleaving the image in some way. That way a screenshot doesn't capture the entire image.

How do you stop someone from pressing the hardware key combination? - you can't let alone enabling screen recording.


I know this is an old post but the question is still there.

If avoiding the user taking a screenshot is not allowed and there's no way to disable that feature, is there any way or workaround that allows to show a security view if the user takes a screenshot in that image? I mean the screenshot shows the security view instead of the original data.


Even though you succeeded doing so, how would you avoid user to snap a picture with a camera ? That would end with very similar result.

So, I fear you are chasing a ghost.

The Confide app does this and they also have an sdk (ScreenShieldKit) for third party developers. If it was done once we should also be able to detect the screenshots.

Not going in details but just giving some pointers..we can detect when a screenshot is taken sign the below code. Once the detection is done..we can either delete the last image in Potos or edit to obscure the content.

Objective C

NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];

[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationUserDidTakeScreenshotNotification



usingBlock:^(NSNotification *note) {

// executes after screenshot/

//Write code here to delete/obscure the last image from photos




forName: UIApplication.userDidTakeScreenshotNotification,

object: nil,

queue: .main) { notification in

// executes after screenshot

//Write code here to delete/obscure the last image from photos


  • You can't delete a photo from Photos library if you are not the owner. It's not allowed. I think you can delete a picture only if your app created it.

Add a Comment

hi could you provide the swift code more in detail? it would be very appreciate

Zuckerberg recently announced that Whatsapp will prevent screenshots on view once messages. Is there some new API am I missing? Or is it just some private API that only Facebook can access?