我正在开发密码管理应用程序。我的团队使用以下 SO 引用来了解如何在一定时间(由用户在设置中选择)后注销用户并将用户直接带回登录页面: iOS perform action after period of inactivity (no user interaction)
我们遇到了一个问题。当用户离开应用程序时,应用程序会自动注销,然后用户导航回应用程序,它会在一瞬间显示用户之前所在的页面。对此进行测试,我能够在那一瞬间捕捉到该页面的照片。这会造成一个安全漏洞,因为该应用程序会在一瞬间显示私有(private)信息,并且可以在照片中捕获!
有没有人有任何建议、链接或示例代码来确保如果您在离开应用程序后导航回应用程序并且应用程序已在后台注销,应用程序将立即显示登录页面?
最佳答案
摘自《iOS App 编程指南》:
What to Do When Moving to the Background
Apps can use their
applicationDidEnterBackground:
method to prepare for moving to the background state. When moving to the background, all apps should do the following:Prepare to have their picture taken. When the
applicationDidEnterBackground:
method returns, the system takes a picture of your app’s user interface and uses the resulting image for transition animations. If any views in your interface contain sensitive information, you should hide or modify those views before theapplicationDidEnterBackground:
method returns.
敏感应用程序的一种解决方案是在 applicationDidEnterBackground:
中抛出一个空白屏幕。当用户返回应用程序时,他们会看到一秒钟的空白屏幕,而不是敏感数据。当然你需要移除applicationWillEnterForeground:
中的黑屏。
关于iOS Autologedout - 应用程序在返回时瞬间显示用户屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18675530/