沙盒路径(OC)

来源:互联网 发布:网络文明志愿宣言 编辑:程序博客网 时间:2024/06/05 19:26
#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
原创粉丝点击