Following the previously received a phone call, text messages and screenshots after monitoring requirements on iOS 11.0 system adds new features play screen recording, so also will usher in a new screen recording monitor demand that anti screen recording monitor function . . .
By official document that capturedDidChangeNotification method can capture screen notifications when status changes, so take this method to expand operations listening, specific code as follows:
First, the method implementation
#pragma mark - monitor the recording / ** monitor screen recording iOS 11.0 or later * / - (void) {// monitorRecordVideo monitor screen recording kWeakSelf (self); Recording status monitoring equipment // if (@available (iOS 11.0, * )) { [[NSNotificationCenter defaultCenter] addObserverForName: UIScreenCapturedDidChangeNotification Object: nil Queue: [NSOperationQueue mainQueue] usingBlock: ^ (* _Nonnull NSNotification Note) { NSLog (@ "screen recording ..."); [weakself showPromptWarningView]; }]; the else {} // ON Fallback Earlier versions } } / ** Tip view * / - (void) {showPromptWarningView UIAlertView * alertView = [[UIAlertView alloc ] initWithTitle: @ " prompt" the Message: @ "Do not record" delegate: Self cancelButtonTitle: nil otherButtonTitles: @ "OK", nil]; [alertView Show]; }
Note: Due to the new method is 11.0 after iOS, so you want to add versions of the system is determined to avoid unnecessary unexpected happens.
Second, the method calls
You can call this method, the page will be ok in viewWillAppear or viewDidLoad method in the page or directly where it is needed.
[Self monitorRecordVideo]; // Anti-recording screen monitor
Screenshot status monitor - iOS
The above is the sharing of content, I hope the content can actually be helpful to you, what deficiencies welcomed the guidance and common progress!