Tom*_*ing 17 directory path objective-c nsbundle
我确定这是一个非常基本的问题,但我无法找到任何相关信息.
说我的应用程序在一个文件夹中,在一些更多的文件夹中,如下所示:
然后,我想要做的是访问"MainFolder"中的文件.我知道我可以通过以下方式获得AppBundle的路径:
NSLog(@"%@",[[NSBundle mainBundle] resourcePath]);
我不确定的是如何获得"MainFolder"的路径.
任何指针都会很棒!
谢谢,汤姆
pix*_*x0r 31
我会用-[NSString stringByDeletingLastPathComponent]两次.
NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
NSString *secondParentPath = [[bundlePath stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];
| 归档时间: | 
 | 
| 查看次数: | 42865 次 | 
| 最近记录: |