我知道這可能看起來像一個一遍又一遍的問題,但我試圖驗證設備上存在的文件(位於支持文件夾中)的名稱的文件是「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