iOS5:如何确定iPhone用户目前是否设置了密码并启用加密?

时间:2012-05-07 13:52:57

标签: ios5

在我看来,iOS 4提示(How can I find out if the iPhone user currently has a passcode set and encryption enabled?)不再起作用了。我想确保用户在使用我的应用程序之前选择了密码,但我没有找到任何方法在iOS5中找到它。创建文件并进行比较

 BOOL fileProtectionEnabled = [NSFileProtectionNone isEqualToString:[testFileAttributes objectForKey:NSFileProtectionKey]];

对锁定和未锁定的设备没有区别。

我还尝试创建这样的文件

[[NSFileManager defaultManager] createFileAtPath:documentFile contents:[@"super secret file contents" dataUsingEncoding:NSUTF8StringEncoding] attributes:[NSDictionary dictionaryWithObject:NSFileProtectionCompleteUntilFirstUserAuthentication forKey:NSFileProtectionKey]];

期望只有在存在密码时才会创建documentFile,但它也是在没有密码的情况下创建的。

0 个答案:

没有答案