监听截屏录屏

2021-05-10  本文已影响0人  kayling
/// 监听录屏截屏
    public func monitorRecordVideoAndScreenshot() {
        if #available(iOS 11.0, *) {
            //录屏通知
            NotificationCenter.default.addObserver(self, selector: #selector(showWarningView_recordVideo), name: UIScreen.capturedDidChangeNotification, object: nil)
        }
        
        //截屏通知
        NotificationCenter.default.addObserver(self, selector: #selector(showWarningView_screenshot), name: UIApplication.userDidTakeScreenshotNotification, object: nil)
    }
/// 监测当前设备是否处于录屏状态
    public func vcIsCaptured(){
        //监测当前设备是否处于录屏状态
        if #available(iOS 11.0, *) {
            let sc = UIScreen.main
            if sc.isCaptured {
                showWarningView_recordVideo()
            }
        }
    }
上一篇 下一篇

猜你喜欢

热点阅读