iOS 写入文件

发布于 2024-12-24 03:50:11 字数 235 浏览 1 评论 0原文

如果设备已越狱,文件系统将被解锁并打开供您查看和修改。如果我想编写一个将文件写入 /private/var/mobile/Library/Preferences/ 文件夹的应用程序,我是否必须使用 [fileManager copyItemAtURL:fileTempPathURL toURL:filePathURL error:NULL] 以外的命令; ?我正在使用这个命令,但它不起作用...感谢您的帮助!

If a device is jailbroken, the file system is unlocked and open for you to see and modify. If I wanted to write an app that wrote a file to the /private/var/mobile/Library/Preferences/ folder, do I have to use a command other than [fileManager copyItemAtURL:fileTempPathURL toURL:filePathURL error:NULL];
? I'm using this command, but it is not working... Thanks for your help!

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

霊感 2024-12-31 03:50:11

如果您使用的是越狱设备,则可以写入系统中的任何位置。您可以通过多种不同的方式来完成此操作,从 C FILE 指针到各种 iOS Foundation 方法,就像您在问题中提到的那样。

您唯一需要注意的是,您的应用程序必须安装在 /Applications 目录中,而不是安装在 ~/Applications 目录中,iTunes 和 Xcode 会这样做默认执行。只有将它们与 MobileSafari、MobileMusicPlayer 等 Apple 基础应用程序一起放入该文件夹中,您的应用程序才会以这些 root 权限从跳板启动。您可以通过 SSH 将其放入 /Applications 文件夹中。

如果您没有像普通 App Store 应用程序一样手动将应用程序放入根应用程序文件夹中,并且您的应用程序驻留在 ~/Applications 中自己的子文件夹中,则您的应用程序将在沙箱中启动。然后,该沙箱将阻止您访问应用程序沙箱之外的任何文件。

If you're on a jailbroken device, you can write to any place in the system. You can do this in many different ways, from the C FILE pointer to all kinds of iOS Foundation methods, like the one you mentioned in your question.

The only thing you'll have to mind is that your application has to be installed in the /Applications directory and not in the ~/Applications directory, what iTunes and Xcode will do by default. Only by putting them in that folder, along with the Apple base applications like MobileSafari, MobileMusicPlayer, etc. your app will launch from the springboard with those root privileges. You can put it in the /Applications folder through SSH.

If you do not manually put your app in the root application folder and your app resides in its own subfolder in ~/Applications like normal App Store applications do, your app will launch in a sandbox. This sandbox will then prevent you from accessing any file outside your application's sandbox.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文