Detecting screen capturing in iOS 11

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.

@property(nonatomic, readonly, getter=isCaptured) BOOL captured;
// swift
var isCaptured: Bool { get }

I also used mirroredScreen property which detects if the screen is being mirrored by an external display.

So, the idea is to check for these bool values and stop the player if any of them are true.

I had to create a notification which will help us notify whenever this bool value turns to be true. The code is in ObjC and is pretty easy to understand. have a look at the code below.

You just have to observe the kScreenRecordingDetectorRecordingStatusChangedNotification and check if the isRecording method returns true or false.

Do check the GITHUB repo for full project.

Detecting screen capturing in iOS 11

Here is a gif for the working app.

That’s it. !


If you enjoyed reading this post, please share and give some clapps so others can find it 👏👏👏👏👏 !!!!

You can follow me on Medium for fresh articles. Also, connect with me on LinkedIn.

If you have any comment, question, or recommendation, feel free to post them in the comment section below!



iOS and tvOS developer, dreamer, photographer 🤨

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


iOS and tvOS developer, dreamer, photographer 🤨