1

I've new app created with Flutter to provide some courses in main screen I use FlutterWindowManager.FLAG_SECURE to prevent screenshot and screen recording It's working prefect in android and user can't make screenshot or screen recording but in ios it's not working and in it's documentation say it's not support ios I know screenshot or screen recording in ios complicated and some people say it's may be impossible

So, is there's any solution to prevent screen recording in ios

slackgate
  • 57
  • 2
  • 7

1 Answers1

0

On iOS I have disabled taking of screenshots with the help of extension https://stackoverflow.com/a/67054892/4899849. Follow next steps:

  1. Add property in AppDelegate:

    var field = UITextField()

  2. in didFinishLaunchingWithOptions call next method: addSecuredView()

     private func addSecuredView() {
       if (!window.subviews.contains(field)) {
         window.addSubview(field)
         field.centerYAnchor.constraint(equalTo: window.centerYAnchor).isActive = true
         field.centerXAnchor.constraint(equalTo: window.centerXAnchor).isActive = true
         window.layer.superlayer?.addSublayer(field.layer)
         field.layer.sublayers?.first?.addSublayer(window.layer)
     }
    

    }

  3. override delegate methods:

     override func applicationWillResignActive(_ application: UIApplication) {
       field.isSecureTextEntry = false
     }
    
     override func applicationDidBecomeActive(_ application: UIApplication) {
       field.isSecureTextEntry = true
     }
    

Now, when you make a screenshot in the app or record a screen video you will see a black image or video.

Volodymyr
  • 1,192
  • 21
  • 42