iOS 获取系统目录

//获取根目录

NSString *homePath = NSHomeDirectory();

NSLog(@"Home目录:%@",homePath);

//获取Documents文件夹目录,第一个参数是说明获取Doucments文件夹目录,第二个参数说明是在当前应用沙盒中获取,所有应用沙盒目录组成一个数组结构的数据存放

NSArray *docPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);

NSString *documentsPath = [docPath objectAtIndex:0];

NSLog(@"Documents目录:%@",documentsPath);

//获取Cache目录

NSArray *cacPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);

NSString *cachePath = [cacPath objectAtIndex:0];

NSLog(@"Cache目录:%@",cachePath);

//Library目录

NSArray *libsPath = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);

NSString *libPath = [libsPath objectAtIndex:0];

NSLog(@"Library目录:%@",libPath);

//temp目录

NSString *tempPath = NSTemporaryDirectory();

NSLog(@"temp目录:%@",tempPath);

上一篇:使用高德地图SDK获取定位信息


下一篇:Storm InvalidTopologyException: null