I’m attempting to dam screenshot in my flutter ios app but it surely’s not working. Person remains to be in a position to take screenshot in his system. May you please assist me to implement blocking screenshot in my flutter app for ios? Thanks prematurely.
Right here you go together with my AppDelegate.swift file code:
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func software(
_ software: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
self.window.makeSecure()
GeneratedPluginRegistrant.register(with: self)
return tremendous.software(software, didFinishLaunchingWithOptions: launchOptions)
}
// Screenshot Forestall Features
extension UIWindow {
func makeSecure() {
let area = UITextField()
area.isSecureTextEntry = true
self.addSubview(area)
area.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
area.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
self.layer.superlayer?.addSublayer(area.layer)
area.layer.sublayers?.first?.addSublayer(self.layer)
}
}