如何确定应用程序包中是否存在文件? [英] How can you determine if a file exists within the app bundle?

查看:118
本文介绍了如何确定应用程序包中是否存在文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,今天愚蠢的问题2。是否可以确定App Bundle中是否包含文件?我可以访问文件没问题,即

Sorry, dumb question number 2 today. Is it possible to determine if a file is contained within the App Bundle? I can access files no problem, i.e.,

NSString *pathAndFileName = [[NSBundle mainBundle] pathForResource:fileName ofType:@"plist"];

但无法弄清楚如何首先检查文件是否存在。

But can't figure out how to check if the file exists there in the first place.

问候

戴夫

推荐答案

[[NSFileManager defaultManager] fileExistsAtPath:pathAndFileName];

这篇关于如何确定应用程序包中是否存在文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆