您的位置:首页 > 其它

沙盒路径(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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  获取沙盒路径