0
我可以驗證是否在我的文件夾NSHomeDirectory中的「文檔」有沒有或至少有一個文件?IOS:驗證一個空的NSHomeDirectory
NSError *error;
NSFileManager *fileMgr = [NSFileManager defaultManager];
// Point to Document directory
NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
// Write out the contents of home directory to console
NSLog(@"Documents directory: %@", [fileMgr contentsOfDirectoryAtPath:documentsDirectory error:&error]);