以编程方式检查是否设置了密码锁 [英] Programmatically Checking if a Passcode Lock is Set

查看:134
本文介绍了以编程方式检查是否设置了密码锁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我的应用程序将处理用户的敏感数据,我想知道是否有一种方法可以从我的应用程序检查iOS中是否设置了密码锁。

Since my app would be dealing with sensitive data of the user, I would like to know if there is a way I can check from my app whether there is a Passcode Lock set in iOS.

我需要检查这个的原因是因为如果用户在应用程序中有一些信息,然后将其保留在桌面上并且出去几分钟。默认情况下,iPad / iPhone进入待机模式。如果设置了密码锁,则只有输入正确的密码后,任何人都可以使用ipad。这将提供额外的安全措施,以防止任何路人从应用程序中查看敏感数据。

The reason I need to check this is because say if the user has in the app some information and then keeps it on the table and goes out for a couple of minutes. The iPad/iPhone by default, goes to standby mode. If a passcode lock had been set, only when the correct passcode is entered, would anyone be able to use the ipad. This would provide an additional security measure to prevent any passerby to view the sensitive data from the app.

所以基本上,我希望我的应用程序检查密码锁是否是设置,如果没有提示用户这样做。

So basically, I would like my app to check whether the passcode lock is set and if not prompt the user to do it.

这可能吗?

推荐答案

查看应用程序运行时环境。文件保护要求用户启用密码锁定设置并设置有效的密码。如果您的应用程序是写/创建和文件,请使用 NSDataWritingFileProtectionComplete 选项。如果您的应用程序不使用任何文件,则创建一个虚拟文件并启用保护。

Take a look at the File Protection section on The Application Runtime Environment. File protection requires the user to have passcode lock setting enabled and a valid passcode set. If you your application writes/creates and file, use the NSDataWritingFileProtectionComplete option. If your application doesn't use any files, then create a dummy file and enable the protection.

这篇关于以编程方式检查是否设置了密码锁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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