写入 iPhone 文件系统 - 越狱/工具链
所以我正在开发一个 jb 应用程序,需要写入文件系统(特别是 /var/mobile/Library/Downloads),我尝试像有人推荐的那样对其进行硬编码,但我似乎无法使其工作,我知道如何对我的应用程序中的文档目录执行此操作,但不对文件系统执行此操作,有什么想法吗?谢谢你!
编辑 1 - 作为参考:Safari DL 插件的方式
so I am working on a jb app that requires writing to the file system (/var/mobile/Library/Downloads specifically), and I tried hard coding it in like someone recommended but I cant seem to make it work, i know how to do so to the Documents directory in my app but not the file system, any ideas? thank you!
edit 1 - as reference: the way that the Safari DL Plugin does it
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这条路
/private/var/mobile/Library/Downloads
在写入之前,您需要检查该目录是否已存在。您可以使用 NSFileManager 类进行文件/目录操作。您还需要检查该文件夹的权限,如果您的应用程序不以 root 身份运行,则无法写入只有 root 有权访问的文件夹。
try this path
/private/var/mobile/Library/Downloads
You need to check if the directory already exists or not before writing to it. You can use NSFileManager class for file/directory operations. You also need to check for the permissions on that folder, your app if not running as root cannot write to folders which only root has access to.