NSSearchPathForDirectoriesInDomains 的问题
我正在尝试工作目录。 不幸的是,当我运行 NSSearchPathForDirectoriesInDomains 时,我得到一个不可写的目录。 我得到的是:
/Users/me/Library/Application Support/iPhone Simulator/User/Documents
当我运行其他人的示例时,我得到:
/Users/me/Library/Application Support/iPhone Simulator/User/Applications/6958D21C-C94B-4843-9EF1-70406D0CA3A3/Documents
可写的文档。
使用的代码片段是
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSLog(documentsDirectory);
我需要做什么才能获得相同的长目录结构?
I am trying to work directories. Unfortunately i get a non-writeable directory when I run NSSearchPathForDirectoriesInDomains. What I get is:
/Users/me/Library/Application Support/iPhone Simulator/User/Documents
When I run other people's examples I get:
/Users/me/Library/Application Support/iPhone Simulator/User/Applications/6958D21C-C94B-4843-9EF1-70406D0CA3A3/Documents
which is writeable.
The snippet of the code used is
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSLog(documentsDirectory);
What do I need to do allow me to get the same long directory structure?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
带有 GUID 的长路径是您的应用程序的文档路径,并且是预期的行为。
不确定您的代码是什么样的,但获取应用程序文档目录的路径应该类似于:(
来自 Mark/LaMarche 第 331 页)
That long path with the GUID is the documents path for your app, and is expected behavior.
Not sure what your code looks like, but getting the path to your app's document directory should be something like:
(From Mark/LaMarche p. 331)
由于它搜索“索引处的对象:0”,
因此可能存在一个以小于“d”的字母开头的文档目录。 这成为“索引为0的对象”。 我知道这可能是不可能的,但也可能是真的。
since it searches for the "object at index:0"
there could be a directory starting with a letter smaller than "d" for documents. Which becomes the "object at index:0". I know this might not be possible but It could be true as well.