I want to quickly check to see if a file exists in my iPhone app's Documents directory (or any path for that matter). I can enumerate through the directory's files, or I can try to open a specific file. What's the fastest way? I just need to know if the file is there or if it does not exist.
我想快速检查一下,看看我的iPhone应用程序的文档目录中是否存在一个文件(或者任何路径)。我可以枚举目录的文件,或者尝试打开一个特定的文件。最快的方法是什么?我只需要知道文件是否存在,或者是否存在。
1 个解决方案
#1
192
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:somePath];
#1
192
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:somePath];