(주)누리웨어

화상연동/Web,APP 구축및서비스/LMS/평생교육/학점은행/기업교육/연수관리/설문구축/

IOS 에 캡처방지 녹화방지

– 기본적으로 방지할수 없어서 해당 프로그램을 실행하면 히든처리하면 되는것 같습니다.


class SceneDelegate: UIResponder, UIWindowSceneDelegate {

~~~~~~~
아래 추가하면 됩니다.

func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
NotificationCenter.default.addObserver(self, selector: #selector(alertPreventScreenCapture(notification:)), name: UIApplication.userDidTakeScreenshotNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(alertPreventScreenCapture(notification:)), name: UIScreen.capturedDidChangeNotification, object: nil)
}

@objc func alertPreventScreenCapture(notification:Notification) -> Void {
let alert = UIAlertController(title: "주의", message: "캡쳐 혹은 녹화를 하면 안됩니다.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
hideScreen()
self.window?.rootViewController!.present(alert, animated: true, completion: nil)
}
//녹화방지를 위한 스크린 히든처리
fileprivate func hideScreen() {
if UIScreen.main.isCaptured {
window?.isHidden = true
} else {
window?.isHidden = false
}
}
}

Comments are currently closed.