I have been all over the web including Apple's dev site but I can't find any instruction on how to set an app's /Documents directory attribute NSFileProtectionKey = NSFileProtectionComplete. I have set the value upon the first time the app runs but is there a way to set it otherwise? Like through some X-Code check box, plist, or other.
Also on a related note: Are any files stored under a directory with the data protection class of NSFileProtectionComplete automatically treated as the same protection class as its directory?
Thanks a bunch,
Fissh
To protect files in your application Documents directory, without any code, you have to add an entitlements.plist to your application.
In your entitlements.plist, add the "DataProtectionClass" key, with the "NSFileProtectionComplete" value. Your files will be automatically protected as long as the device is locked.
Here is an example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DataProtectionClass</key>
<string>NSFileProtectionComplete</string>
</dict>
</plist>