本文介绍了什么是测试文件存在的快速方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想快速检查我的iPhone应用程序的Documents目录(或任何路径)中是否存在文件。我可以枚举目录的文件,或者我可以尝试打开特定的文件。什么是最快的方式?我只需要知道文件是否存在或者是否存在。

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.

推荐答案

BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:somePath];

这篇关于什么是测试文件存在的快速方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 01:58
查看更多