Is there any possible way to make a blur ViewController in iOS when a user tries to take a screenshot?
Or any option that executes a function before the screenshot is saved?
Is there any possible way to make a blur ViewController in iOS when a user tries to take a screenshot?
Or any option that executes a function before the screenshot is saved?
Not really, but even if there was one, this doesn't prevent users from taking pictures of the screen so it doesn't protect the data all that much.
What you want cannot be achieved using any public APIs. In older iOS versions it was possible to rely on touching the screen to show sensitive information, but since iOS 7 taking screenshot no longer cancels touches.
Relying on observing NSNotification.Name.UIApplicationUserDidTakeScreenshot
notification is also out of the question, since that notification is posted after the screenshot is taken, not before - it follows iOS naming convention with DidTake
statement, and there is no WillTake
equivalent of this notification.
The solution linked in comment - ScreenShieldKit - also seem to be useless, since this post on Information Security subforum claims it indeed relies on canceling touches which, as mentioned before, no longer works.
At any rate: no, currently there is no known way to prevent screenshots from being taken, using publicly available APIs.