NSFileProtectionComplete for iOS 4.0 Applications

I saw a WWDC 2010 video about NSFileProtectionComplete and application data protection.

Are there any examples there? Does anyone have sample code for sharing?

+5
source share
1 answer

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

+10
source

Source: https://habr.com/ru/post/923016/


All Articles