1.获取APP程序路径
NSString *path = [NSHomeDirectory();
2.获取沙盒Documents
1.NSDocumentDirectory ---->要获取的Documents 2.NSUserDomainMask--->在当前应用程序下
NSCachesDirectory ----->缓存目录
NSString *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
或
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/data.plist"];
3.获取临时目录
NSString *path = NSTemporaryDirectory();
4.获取App程序应用包路径
NSString * path = [[NSBundle mainBundle] resourcePath];
时间: 2024-10-06 00:10:52