iOS detect/block screen recording using QuickTime player

后端 未结 2 463
醉话见心
醉话见心 2021-02-11 10:43

I want to block screen recording or video output per my app using QuickTime Player.

I had detected hdmi output and airplay with UIScreen. But QuickTime Play

2条回答
  •  暖寄归人
    2021-02-11 11:46

    With iOS 11 you can use the notification

    NSNotification.Name.UIScreenCapturedDidChange
    

    on AppDelegate.swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
        NotificationCenter.default.addObserver(self, selector: #selector(checkIFScreenIsCapture), name: NSNotification.Name.UIScreenCapturedDidChange, object: nil) ......
    

    use selector

    func checkIFScreenIsCapture(notification:Notification){
        guard let screen = notification.object as? UIScreen else { return }
        if screen.isCaptured == true {
    
        }else{
    
        }
    }
    

提交回复
热议问题