沙盒路径(OC)
2017-07-03 19:11
197 查看
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; //获取家目录,也就是根目录 NSString * homePath=NSHomeDirectory(); NSLog(@"家目录:%@",homePath); //获取DocuMents路径 NSArray * pathArr1=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString * docuPath=[pathArr1 objectAtIndex:0]; NSLog(@"DocuMents路径:%@",docuPath); //Library路径 NSArray * pathArr2=NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString * libPath=[pathArr2 objectAtIndex:0]; NSLog(@"Library路径:%@",libPath); //获取tmp路径 NSString * tmpPath=NSTemporaryDirectory(); NSLog(@"temp的路径:%@",tmpPath); //获取Library下的cachPath路径 NSArray * pathArr3=NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString * cachPath=pathArr3[0]; NSLog(@"cachPath路径:%@",cachPath); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end
相关文章推荐
- 黑马程序员---OC学习笔记之ios沙盒机制及获取沙盒路径
- OC中获取沙盒中的Documents目录路径常用的代码方式
- 沙盒路径(OC)
- iOS开发获取沙盒文件路径
- iOS 沙盒路径详解(存储路径的选择)
- iOS8 沙盒路径变化特性
- iOS沙盒(sandbox)机制及获取沙盒路径
- iOS之沙盒路径
- iOS沙盒路径的查看和使用
- iOS-沙盒路径
- 获取沙盒文件夹路径
- 创建并且获取图片沙盒路径
- [IOS]沙盒(sandbox)机制及获取沙盒路径
- iOS获取沙盒路径等
- IOS 8 模拟器中工程的 .app路径和 沙盒路径的获取方式以及路径对比
- 定义两个宏,获取沙盒和缓存路径
- [置顶] iOS在沙盒Documents中创建文件夹以及获取沙盒路径
- iOS沙盒(sandbox)机制及获取沙盒路径
- 使用OC swift 截取路径中的最后的文件名
- swift之沙盒路径、沙盒存储