It seems to me that the hint of iOS 4 ( How can I find out if an iPhone user currently has a set of passwords and encryption is enabled? ) Does not work anymore. I want to make sure that the user has selected a password before he can use my application, but I did not find in iOS5 the ability to find this. Creating a file and comparing this
BOOL fileProtectionEnabled = [NSFileProtectionNone isEqualToString:[testFileAttributes objectForKey:NSFileProtectionKey]];
Does not affect a locked and unlocked device.
I also tried to create a file like this
[[NSFileManager defaultManager] createFileAtPath:documentFile contents:[@"super secret file contents" dataUsingEncoding:NSUTF8StringEncoding] attributes:[NSDictionary dictionaryWithObject:NSFileProtectionCompleteUntilFirstUserAuthentication forKey:NSFileProtectionKey]];
expecting a documentFile will be created only when there is a password, but it is also created without an access code.
source
share