我想从控制台看到Documents文件夹的内容,我可以看到模拟器,但它不适用于设备
我的路径是/ var/mobile/Applications/3E79C7B3-2639-477F-B355-1A3C70D4ECBE/Documents 但如何查看?
您可以像这样获取Documents目录的位置:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
path = [paths objectAtIndex:0];
Run Code Online (Sandbox Code Playgroud)
然后只需将目录的内容打印到控制台:
NSLog(@"%@", [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]);
Run Code Online (Sandbox Code Playgroud)
以下是相关文档:http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/LowLevelFileMgmt/Articles/StandardDirectories.html