沙箱 Sandbox 的路径

和其他很多应用平台一样,iOS 也限定了每个 APP 的活动范围,只能被限定在一个硬盘空间里,即 Sandbox。如何拿到这个 Sandbox。很容易:

NSString *outDirPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];

这个 outDirPath 就是沙箱的 path。

拿到 Resource 的路径

Resource 和 Sandbox 不在同一个路径。Resource 是应用被系统创建时,由系统决定的。你只能问系统要。

NSString * wavFilePath = [[NSBundle mainBundle] pathForResource:@"abc" ofType:@"jpg"];

如上 NSBundle 的 mainBundle 方法拿到应用的所在路径。这句话找到的是 abc.jpg 文件。

-

转载请注明来自:http://blog.csdn.net/prevention

相关文章:

  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-17
  • 2021-07-13
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
相关资源
相似解决方案