Possible to detect if a user is pressing the screen capture buttons on iOS??

丶灬走出姿态 提交于 2020-01-16 04:00:13

问题


I need to know if the user is trying to take a screen capture of a specific section on an app we are building. Any advice would be helpful. We would like to then black out the screen to prevent a screen shot from being taken.


回答1:


No. Its not possible to find out.




回答2:


You cann't control Home and Switch buttons actions. It is the default hardware behaviour.




回答3:


I also believe it to be impossible to detect.

I did a few tests, thinking that the iOS might call

-(void) applicationDidEnterBackground:(UIApplication*)application or

- (void)applicationWillResignActive:(UIApplication *)application

might be called, but NSLogs in those methods weren't called when I took a screenshot.

I did find this but it's also not available in iOS 5.0+. (perhaps even not after iOS 4.0+)

The PictureWasTakenNotification Darwin notification will be sent when the user takes a screenshot. However, this is sent after the screenshot is taken.

[source]



来源:https://stackoverflow.com/questions/9097617/possible-to-detect-if-a-user-is-pressing-the-screen-capture-buttons-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!