访问沙箱外的用户主文件夹

发布于 2024-10-03 19:42:19 字数 254 浏览 0 评论 0原文

我正在开发一个不会提交到 AppStore 的应用程序,并尝试打开用户使用 Safari 下载管理器下载的文件。

该插件提到所有文件都在 ~/Media/Downloads 中下载。

我尝试过仅使用 NSString 的 stringByExpandingTildeInPath ,但它将映射到应用程序沙箱内的 /Media/Downloads 。

问题是:如何扩展该路径以使其映射到实际文件夹?

谢谢!

I'm working on a app which will not be submitted to the AppStore and am trying to open a file which the user has downloaded using Safari Download Manager.

This plugin mentions all files are downloaded inside ~/Media/Downloads.

I've tried just using NSString's stringByExpandingTildeInPath, but it will map to /Media/Downloads inside the application sandbox.

Question is: how can I tilde-expand that path so it maps to the actual folder?

Thanks!

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

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

发布评论

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

评论(2

把回忆走一遍 2024-10-10 19:42:19

我认为“Safari 下载管理器”意味着您已经拥有一部越狱的手机。如果是这样,最简单的方法是安装 iFile 之类的东西并找出路径是什么。

我假设它类似于 /var/mobile/Media/Downloads。然后,您可以做两件简单的事情:

  • 硬编码“/var/mobile”以在字符串开头展开波浪号。
  • 找出您想要其 homedir 的用户名(可能是“mobile”)并尝试展开 ~mobile/Media/Downloads。
  • 找到用户名,并通过调用 getpwnam() 等获取 homedir(假设它存在于 iOS 上)。

I assume that by "Safari Download Manager" you mean that you already have a jailbroken phone. If so, the easiest way is to just install something like iFile and find out what the path is.

I'm assuming that it's something like /var/mobile/Media/Downloads. Then, there are two easy things you can do:

  • Hard-code "/var/mobile" to expand a tilde at the beginning of the string.
  • Find out the username you want the homedir for (probably "mobile") and try expanding ~mobile/Media/Downloads.
  • Find the username, and get the homedir with a call to getpwnam() or so (assuming it exists on iOS).
凉月流沐 2024-10-10 19:42:19

沙箱不仅是 App Store 提交的必需品,也是设备的一项功能。没有越狱,你就不走运了。

The sandbox isn't just a necessity for App Store submission, it's a feature of the device. Without jailbreaking, you're out of luck.

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