如何在iOS中获取目录的路径应用程序

问题描述:

我正在为iPhone编写mp3播放器应用程序,并遇到了麻烦,如何获取iOS设备中的资源目录的路径。 谢谢如何在iOS中获取目录的路径应用程序

+0

只要你明白,在这个网站上,你应该自己做一些工作,看看你的问题可能已经得到解答。快速搜索“iOS资源文件夹”打开此链接:http://*.com/q/8430685/96716 – 2012-07-20 13:20:33

这将让你的路径到你的应用程序文件结构中的几个不同的地方。

NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; 
NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Populator"]; 
NSString *folderPath = [documentsDirectory stringByAppendingPathComponent:@"Files"]; 
NSLog(@"Source Path: %@\n Documents Path: %@ \n Folder Path: %@", sourcePath, documentsDirectory, folderPath);