在 iPhone 模拟器上模拟数据保护

发布于 2024-12-21 22:08:25 字数 530 浏览 2 评论 0原文

我正在尝试研究 iPhone 模拟器上的数据保护过程,但我在第一步失败了。我创建了一个数据库文件并将其添加到应用程序资源中。在应用程序启动期间,我将此文件复制到应用程序文件夹。

然后我这样做:

NSDictionary *fileAttributes = [NSDictionary dictionaryWithObject:NSFileProtectionComplete forKey:NSFileProtectionKey];

if (![[NSFileManager defaultManager] setAttributes:fileAttributes ofItemAtPath:appDBPath error:&error]) {
        //handle error
    }

但是当我检查文件属性后,我没有得到密钥 NSFileProtectionKey

我是否遗漏了一些明显的东西?我们是否必须添加任何数据保护框架?

还是只能在设备上测试?

我需要尽快完成它..请帮助我:(

I am trying study the Data Protection Process on iPhone Simulator, but i am failing at the initial step.I created a DB File and added it to the Application Resources. During the Application Launch i copy this file to the Application Folder.

Then i do this:

NSDictionary *fileAttributes = [NSDictionary dictionaryWithObject:NSFileProtectionComplete forKey:NSFileProtectionKey];

if (![[NSFileManager defaultManager] setAttributes:fileAttributes ofItemAtPath:appDBPath error:&error]) {
        //handle error
    }

But when i check the file attributes after this, i do not get the key NSFileProtectionKey

Am i missing something obvious in it? Do we have to add any Framework for Data Protection?

Or is it that this can only be tested on the device?

I need to get it done quickly.. Please help me guys :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文