Prevent Screenshot feature

Apple is so popular for privacy / data protection. But I'm wondering that why they didn't provide any Public API to prevent screenshot for a particular view controller or for Entire app.

Current solution is to do something like this (https://stackoverflow.com/a/67054892/4061501 OR https://stackoverflow.com/a/74373160/4061501). This utilises UITextField's hidden feature to make screen blank when taking screenshot.

Please comment out if there are any better solutions available.

Replies

That's when you take a screenshot.

But what if to take a photo of the screen from another camera ?

This just shows there is no perfect solution to the question.

Screenshots are an important feature for the user to have available at all times for a number of reasons – including the protection of their own privacy.

A screenshot cannot capture anything that the user themselves have not already gained access to in some way, And as Claude31 pointed out, you can always use a secondary device to capture the same information if you are sufficiently motivated. As such blocking same-device screenshots is not very valuable in a world where everyone has a camera.

Fundamentally, users have a lot of use cases for taking screenshots. As developers it is not really our place to question their use cases. If you have a use case where taking a screenshot would be a bad idea, then it may also be an opportunity to provide a user experience that is better than doing so (for example discouraging users to screenshot private information by making is easy for them to access that information at any time). But do consider it from the user's POV – just because taking a screenshot of "super secret password" may be a bad idea, doesn't mean that they won't just do something worse if you block them from doing so.