菜鸟教程小白 发表于 2022-12-12 21:20:40

ios - 在 iDevice 锁定状态下访问文档目录的任何其他方式?


                                            <p><p>我正在 iOS 平台上实现音乐播放器应用程序。在这里,我使用 Documents 目录存储和检索媒体内容。因此,当 iPhone 被密码锁定时,我无法访问“文档目录”。我提到了 Apple 开发人员库,他们说加密和解密是在从文档目录访问文件内容下进行的。 <strong>因此,如果设备被锁定,则解密 key 将被销毁</strong>。在这里,我附上了问题描述的屏幕截图。在过去的两个月里,我一直被这个问题困扰。请给我任何其他方式在锁定状态下访问 Documents 目录。不仅是媒体,任何其他内容*。</p>

<p>提前致谢。</p>

<p> <img src="/image/i3vvX.png" alt="Screen Shot"/> </p>

<p>苹果开发者网站:
<a href="https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html" rel="noreferrer noopener nofollow">https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html</a> </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您需要在写入文件时指定文件保护级别作为选项。示例:</p>

<pre><code>;
</code></pre>

<p>在此,<code>someData</code> 是您要写入磁盘的数据的 NSData 表示,<code>filePath</code> 是您要保存文件的字符串路径。</p>

<p>阅读 <a href="https://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/classes/NSData_Class/Reference/Reference.html" rel="noreferrer noopener nofollow">NSData Class Reference</a> 中关于 <code>NSDataWritingOptions</code> 的文档了解更多加密选项。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 在 iDevice 锁定状态下访问文档目录的任何其他方式?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/22952929/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/22952929/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 在 iDevice 锁定状态下访问文档目录的任何其他方式?