//当用户录屏 怎么办 现在来说 只能举行提示。监听到就返回上一页,并弹出提示
1,检测当前装备是否在录屏:
pragma mark -- 录屏
- (void)addLuPingJianTing{
//监测当前装备是否处于录屏状态
UIScreen * sc = [UIScreen mainScreen];
if (@available(iOS 11.0,*)) {
if (sc.isCaptured) {
NSLog(@"正在录制-----%d",sc.isCaptured);
// 耽误三秒去实行
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.navigationController popViewControllerAnimated:YES];
});
// 耽误三秒去实行
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NormalAlartView view = [[[NSBundle mainBundle] loadNibNamed"NormalAlartView" owner:self options:nil] lastObject];
view.isLuPing = YES;
view.titleLabel.text = LocalizedString(@"为掩护教程版权,请制止录屏使用!");
view.sureBtn.hidden = YES;
[view.cancleBtn setTitleocalizedString(@"我知道了") forStateUIControlStateNormal)];
[view show];
});
}
}
//ios11之后才可以录屏
if (@available(iOS 11.0,)) {
//检测装备
[[NSNotificationCenter defaultCenter]addObserver:self selectorselector(tipsVideoRecord) name:UIScreenCapturedDidChangeNotification object:nil];
}
}
iOS 11.0之后 可以通过关照检测检测装备录屏
- (void)tipsVideoRecord {
UIScreen * sc = [UIScreen mainScreen];
if (@available(iOS 11.0,*)) {
if (sc.isCaptured) {
// 耽误三秒去实行
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NormalAlartView *view = [[[NSBundle mainBundle] loadNibNamed"NormalAlartView" owner:self options:nil] lastObject];
view.isLuPing = YES;
view.titleLabel.text = LocalizedString(@"为掩护教程版权,请不要录屏!");
view.sureBtn.hidden = YES;
[view.cancleBtn setTitleocalizedString(@"我知道了") forStateUIControlStateNormal)];
[view show];
});
}
}
}
|