prongbang/screen_protector

iOS 17 screenshot disable not working

Closed this issue ยท 10 comments

await ScreenProtector.preventScreenshotOn(); is not working on iOS 17 beta. I suppose it won't be working on iOS 17 which will be release Monday 18th September

same here any solution ?

same here

Some changes here. I need it to work on iOS 17, but unfortunately it doesn't work :(

I found a workaround. dm me for info.

Why can't you post this workaround here so that everyone interested may have a look?

@awnigharbia can u please share the solution over here so all Dev can have access of it.

There is workaround available, you have to add following code to your AppDelegate.swift file.

At the bottom of the file:
extension UIWindow { func makeSecure() { let field = UITextField() field.isSecureTextEntry = true self.addSubview(field) field.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true field.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true self.layer.superlayer?.addSublayer(field.layer) field.layer.sublayers?.last?.addSublayer(self.layer) } }

And then invoke makeSecure() in application function:
self.window.makeSecure()

There is workaround available, you have to add following code to your AppDelegate.swift file.

At the bottom of the file: extension UIWindow { func makeSecure() { let field = UITextField() field.isSecureTextEntry = true self.addSubview(field) field.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true field.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true self.layer.superlayer?.addSublayer(field.layer) field.layer.sublayers?.last?.addSublayer(self.layer) } }

And then invoke makeSecure() in application function: self.window.makeSecure()

Its working .TY!!!

Thank you for reporting the issue. We will address it as quickly as possible.

Could you try using this version screen_protector: ^1.3.2 to see if it might fix the issue you are currently facing?

Could you try using this version screen_protector: ^1.3.2 to see if it might fix the issue you are currently facing?

Everything works fine. Ty