iOS7 Screen Capture Prevention / Detection

2019-08-18 02:02发布

In my iOS app I need either prevent the screenshot capture (by pressing combination of Home +Power button), or need to detect before it saved to the Photo library . In previous iOS version before taking screenshot touchesCancelled:withEvent this method will called , but iOS7 onwards this wont work. Apple provide a notification

 UIApplicationUserDidTakeScreenshotNotification

for detecting screenshot capture .The real problem is this will fire only after the screenshot is saved in Photo library .

Is there any methods (Private /Public) for detecting screenshot before it happens , or Just prevent the screenshot feature .

Dont consider it as a duplicate question , it is iOS7 specific question

2条回答
孤傲高冷的网名
2楼-- · 2019-08-18 02:33

No, nothing has changed since iOS7 and it will not change in the future, it is a conceptual issue, iOS app doesn't has control over the device public functions, consider you turned off 'taking screenshot' while other application needs it!! How this app would know about that?

Best thing you can do is using Configuration Profile as mentioned @QED valid answer.

查看更多
家丑人穷心不美
3楼-- · 2019-08-18 02:46

You can restrict with a Configuration Profile, as described in the linked question.

Check out the Restrictions Payload section, starting on page 27, of the iPhone Configuration Proifile Reference. The key you want is allowScreenShot, described at the bottom of page 30.

Also, the linked reference states that there are a number of ways to install a profile. It may be possible for you to provide, within the app, some method for the user to trigger your server to install/reinstall your profile. Just a thought, I'm not experienced in the matter.

I'm not able to speak to private APIs. You might check out http://www.modmyi.com, or snoop around on IRC for some jailbreak communities. There are lots of experts out there who may be able to point you to the API, but they don't tend to hang on SO.

Good luck!

查看更多
登录 后发表回答