See the NSFileManager class document:
The file is stored in an encrypted format on disk and cannot be read from or written while the device is locked or loaded.
This is basically a file repository for individual files. You just pass a constant when setting the attributes of the file.
To mark a file as protected, you must add an extended attribute to it. The Foundation Foundation includes two ways to add this attribute:
When writing the contents of an NSData object to disk using writeToFile: options: error: method, include the NSDataWritingFileProtectionComplete option.
Use SetAttributes: ofItemAtPath: error: NSFileManager method to add the NSFileProtectionKey attribute (with the value NSFileProtectionComplete) to an existing file
.
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StandardBehaviors/StandardBehaviors.html
source share