How to disable screen Recording in iOS app

前端 未结 3 2037
抹茶落季
抹茶落季 2021-01-03 03:17

Is there any way to disable the screen recording? or is is possible through a configuration profile? or any third party library is available?

3条回答
  •  有刺的猬
    2021-01-03 03:25

    NotificationCenter.default.addObserver(self, selector: #selector(preventScreenRecording), name: NSNotification.Name.UIScreenCapturedDidChange, object: nil)
    

    And create a view inside main view and prevent like that.

    (void) preventScreenRecording {
    if (@available(iOS 11.0, *)) {
        BOOL isCaptured = [[UIScreen mainScreen] isCaptured];
    
        if (isCaptured) {
            self.blockView.hidden = false;
        }
        else {
            self.blockView.hidden = true;
        }
    }
    

提交回复
热议问题