防止iOS在进入后台之前截取应用程序的屏幕截图 [英] Prevent iOS from taking screen capture of app before going into background

查看:55
本文介绍了防止iOS在进入后台之前截取应用程序的屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你们可能都知道,iOS 在将应用程序放入后台之前会对其进行屏幕截图.这通常是为了更好的用户体验,例如快速动画以将应用程序带回来等等.我不希望我的应用屏幕截图存储在设备上,但我希望多任务处理仍然存在.

You all might know that iOS takes a screen shot of your application before throwing it into the background. This is usually for a better User experience like quick animation to bring the app back and so on. I don't want my app screen shot to be stored on the device, but I want the multitasking to still exist.

我想出了一个解决方案,但我不确定我是否朝着正确的方向前进.因此,当 applicationDidEnterBackground 被调用时——我放入一个将由操作系统捕获的覆盖图像,一旦应用程序进入前台,我将删除覆盖.我不确定这是否会奏效,但我正在努力实现这一点.同时,对此的任何其他想法都将帮助我找出解决此问题的最佳方法.

I came out with a solution but I'm not sure if I'm heading in the right direction. So, when the applicationDidEnterBackground is called -- I put in an overlay image that will be captured by the OS, and once the app enters foreground, I will remove the overlay. I'm not sure if this is going to work but I'm on my way to implement this. Meanwhile, any other thoughts on this will help me figure out the optimal way of attacking this issue.

推荐答案

您走对了.这是 Apple 推荐的执行此操作的方法 如中所述iOS 应用程序编程指南:

You are on the right track. This is Apple's recommended way to do this as noted in the iOS Application Programming Guide:

在移到后台之前从视图中删除敏感信息.当应用程序转换到后台时,系统会拍摄应用程序主窗口的快照,然后在将应用程序转换回来时简要显示到前台.在从您的 applicationDidEnterBackground: 方法返回之前,您应该隐藏或隐藏密码和其他可能作为快照一部分捕获的敏感个人信息.

Remove sensitive information from views before moving to the background. When an application transitions to the background, the system takes a snapshot of the application’s main window, which it then presents briefly when transitioning your application back to the foreground. Before returning from your applicationDidEnterBackground: method, you should hide or obscure passwords and other sensitive personal information that might be captured as part of the snapshot.

这篇关于防止iOS在进入后台之前截取应用程序的屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆