开发者

Access user home folder outside sandbox

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 f开发者_如何学Ciles 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!


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).


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜