[英]iOS Screen recording detection
I tried to detect if screen capture is on for the application for iOS 11, to detect this the UIScreen.mainScreen.isCaptured
property is used to check if it is recorded. 我试图检测是否为iOS 11的应用程序打开了屏幕捕获,以检测到该
UIScreen.mainScreen.isCaptured
属性用于检查是否已记录。
It works fine for the first launch, when the app is terminated and launched again, then the API returns NO though the screen capture is on. 对于第一次启动,当应用程序终止并再次启动时,它运行良好,尽管打开了屏幕截图,但API返回NO。
Code: 码:
//In viewWillAppear block
__block ViewController *weakSelf = self;
[NSTimer scheduledTimerWithTimeInterval:2.0 repeats:YES block:^(NSTimer * _Nonnull timer) {
[weakSelf screenCaptureDetection];
}];
- (void) screenCaptureDetection {
if (@available(iOS 11.0, *)) {
for (UIScreen *screen in [UIScreen screens]) {
if([screen performSelector:@selector(isCaptured)]){
//Detected YES
}
}
}
Use case scenario: 用例场景:
UIScreen.mainScreen.isCaptured
returns NO UIScreen.mainScreen.isCaptured
返回“否” Please suggest 请建议
You should check for recording repeatedly. 您应该反复检查录音。
I used this code and it worked for me. 我使用了这段代码,它为我工作。 check it out:
看看这个:
https://gist.github.com/abhimuralidharan/8db55dff9023028867b719f251372bd7#file-screenrecordingdetector-m https://gist.github.com/abhimuralidharan/8db55dff9023028867b719f251372bd7#file-screenrecordingdetector-m
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.