我知道这可能看起来像一个一遍又一遍的问题,但我试图验证设备上存在的文件(位于支持文件夹中)的名称的文件是“names.txt”。从文件读取和写入
从我读过下面的代码应该工作,但我不断得到“文件未找到。”
NSFileManager *filemgr = [NSFileManager defaultManager];
NSString *path = @"names.txt";
if ([filemgr fileExistsAtPath:path]) {
NSLog (@"File exists");
}
else {
NSLog (@"File not found");
}
是names.txt文件的完整路径吗? – bryanmac