iphone - 适用于 iOS 4.0 应用程序的 NSFileProtectionComplete

标签 iphone security ios4 nsfilemanager

我观看了有关 NSFileProtectionComplete 和保护应用数据的 WWDC 2010 视频。

有什么例子吗?有没有人可以分享示例代码?

最佳答案

查看 NSFileManager 类文档:

The file is stored in an encrypted format on disk and cannot be read from or written to while the device is locked or booting.

它基本上是单个文件的文件库。您只需在设置文件属性时传递常量即可。

To mark a file as protected, you must add an extended attribute to it. The Foundation framework includes two ways to add this attribute:

When writing the contents of an NSData object to disk using the writeToFile:options:error: method, include the NSDataWritingFileProtectionComplete option.

Use the setAttributes:ofItemAtPath:error: method of NSFileManager to add the NSFileProtectionKey attribute (with the NSFileProtectionComplete value) to an existing file

.

http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StandardBehaviors/StandardBehaviors.html

关于iphone - 适用于 iOS 4.0 应用程序的 NSFileProtectionComplete,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3217683/

相关文章:

iphone - stringWithString 内存泄漏

iphone - UITableView 滚动缓慢

iphone - 自定义 UILocalNotification 警报 - 使用滑动 slider 或按钮

javascript - 如果我有 div 中的数据,有人可以更改发送到服务器的数据吗

ios - 如何隐藏在 ios 中的文档目录中创建的文件夹?

iphone - 在 iOS4 中保存 PDF 文件时出现问题

iphone - iPhone 应用程序中的音频反馈问题

php - PHP 的 $_SERVER ['REMOTE_ADDR' 的可靠性]

iphone-sdk-3.0 - Monotouch 设置状态栏隐藏 - API 更改安全

java - 最近的java漏洞对Android和编程有什么影响?