一,代码。

【代码笔记】iOS-获得Documents目录-LMLPHP
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib. //获得Documents目录
NSString *destPath = NSHomeDirectory();
NSLog(@"-----path----%@",destPath); }
【代码笔记】iOS-获得Documents目录-LMLPHP

二,输出。

2015-10-23 11:19:36.413 NSHomeDirectoryDemo[5673:135889] -----path----/Users/chenlihua/Library/Developer/CoreSimulator/Devices/78D1FCBF-9990-471F-9075-168F2CE949FE/data/Containers/Data/Application/B9C6534B-0478-4976-811A-EE62ADC702DB
05-11 21:46