Seems to me, that the iOS 4 hint (How can I find out if the iPhone user currently has a passcode set and encryption enabled?) does not work any more. I want make sure that user has chosen a passcode before he can use my app, but I did not find any way in iOS5 to find that out. Creating a file and comparing like this
BOOL fileProtectionEnabled = [NSFileProtectionNone isEqualToString:[testFileAttributes objectForKey:NSFileProtectionKey]];
does not make a difference in an locked and a 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 that the documentFile would only be created when there is a passcode, but it's also created without a passcode.