Detecting screen capturing in iOS | SWIFT

We were working on an iOS app which provide paid video content. So the possibility of getting the video being recorded using the iOS 11 screen capture feature was something that needs to be handled. Here is how I did it. NB: The code is in Objective-C as I was working on an old project. It is pretty simple and you can easily convert it to swift if you wish.

Abhimuralidharan
2 min readDec 29, 2017

My requirement was to restrict the user from recording the video as all the videos in my app are only available for paid users. I thought of restricting the screen recording if my app was active. I couldn’t find any solution to prevent screen recording (or screenshot) for our app alone. This is an OS level feature and cannot be overriden (I couldn’t find any solution. Please do comment if you have any knowledge on this).

So, the only solution was to pause or stop the player if screen recording is happening. Luckily iOS provides a solution for this. An instance property available on UIScreen from iOS 11 called captured (isCaptured in swift). Its a Boolean value that indicates whether the contents of the screen are being cloned to another destination.

--

--

Abhimuralidharan
Abhimuralidharan

Written by Abhimuralidharan

iOS and tvOS developer, dreamer, photographer 🤨

Responses (10)