ScreenshotPreventing-iOS icon indicating copy to clipboard operation
ScreenshotPreventing-iOS copied to clipboard

Does it work with ios17 beta?

Open f-exuan21 opened this issue 1 year ago • 10 comments

Does it work with ios17 beta? For me, it doesn't work...

f-exuan21 avatar Jul 12 '23 22:07 f-exuan21

Does it work with ios17 beta? For me, it doesn't work...

Did you solve it on iOS17

aerialkoala avatar Oct 18 '23 02:10 aerialkoala

Does it work with ios17 beta? For me, it doesn't work...

Did you solve it on iOS17

Yes I did. But I didn't use this code. :(

f-exuan21 avatar Oct 18 '23 02:10 f-exuan21

Does it work with ios17 beta? For me, it doesn't work...

Did you solve it on iOS17

Yes I did. But I didn't use this code. :(

could you show me your code? you know why it doesn't work

aerialkoala avatar Oct 18 '23 03:10 aerialkoala

Does it work with ios17 beta? For me, it doesn't work...

Did you solve it on iOS17

Yes I did. But I didn't use this code. :(

could you show me your code? you know why it doesn't work

Sure. I'll show you before tomorrow.

f-exuan21 avatar Oct 18 '23 03:10 f-exuan21

Does it work with ios17 beta? For me, it doesn't work...

Did you solve it on iOS17

Yes I did. But I didn't use this code. :(

could you show me your code? you know why it doesn't work

extension UIView {

    func blockScreenShot() {
        DispatchQueue.main.asyc {
            let field = UITextField()
            field.isSecureTextEntry = true
            field.isUserInteractionEnabled = false

            self.addSubview(field)
            field.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
            field.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true

            field.layer.removeFromSuperlayer()
            self.layer.superlayer?.insertSublayer(field.layer, at: 0)
            field.layer.sublayers?.last?.addSublayer(self.layer)
        }
    }

}

You can use it for the view you want to block the screenshot. For example, i applied the code to window's view.

self.window?.blockScreenShot()
  • This code might be able to contain typos.

f-exuan21 avatar Oct 19 '23 16:10 f-exuan21

@f-exuan21 i am unable to use i tried to use this in viewdidload

swarajsinghdev avatar Mar 21 '24 05:03 swarajsinghdev

@aerialkoala @f-exuan21 ScreenShield is a similar library that provides a simple way to protect your app's content from being captured or recorded by screenshots and screen recordings, supported in iOS 17 as well. ScreenShield

JayantBadlani avatar Apr 18 '24 05:04 JayantBadlani

@f-exuan21 i am unable to use i tried to use this in viewdidload

If you don't set the correct Autolayout, it won't work well. I recommend you check that part.

f-exuan21 avatar Apr 18 '24 05:04 f-exuan21

Does it work with ios17 beta? For me, it doesn't work...

Did you solve it on iOS17

Yes I did. But I didn't use this code. :(

What did you use then??

malt-blue-gen avatar May 03 '24 15:05 malt-blue-gen

@yoxisem544, @malt-blue-gen you can try ScreenShield, it's updated and support iOS17

JayantBadlani avatar May 03 '24 16:05 JayantBadlani