注意:
虚拟机Home目录: /Users/userName/Library/Application Support/iPhone Simulator/6.1/Applications/C926CCFA-A110-45E2-B4AD-7E5679152D99
真机Home目录: /var/mobile/Applications/304D8530-98CB-4043-A208-EBF06E8ADBB9
NSArray *documents = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
// 只有一个匹配目录,所以这个集合里面只有一个元素 NSString *doc = documents[0];
// 使用字符串拼接的方式获取目录名
NSString *doc2 = [home stringByAppendingPathComponent:@"Documents"];
NSArray *caches = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cache = caches[0];
通过NSUserDefaults类存取该目录下的设置信息
NSString *tmpDir = NSTemporaryDirectory();
原文地址:http://www.cnblogs.com/litaowei/p/3757826.html