目标c,检查文件存在于路径中 [英] objective c,checking file exist at path

查看:87
本文介绍了目标c,检查文件存在于路径中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone项目中使用Objective-C创建了一个屏幕。在那里,有2个按钮(比如A和B)。单击按钮A,将在一个文件夹(例如INBOX)中创建一个xml文件。

I have created a screen using Objective-C in an iPhone project. In that, there are 2 buttons (say A and B). On the click of button A, one xml file will be created in a folder (say INBOX).

我的问题是,我只需要创建文件文件夹INBOX中不存在。
我该怎么办?任何人都可以告诉我语法吗?

My problem is, I need to create the file only if it does not exist at folder INBOX. How can I do this? Can any one tell me the syntax?

推荐答案

你能检查NSFileManager吗。

Can you Please Check NSFileManager.

NSFileManager *fileManager = [NSFileManager defaultManager];

NSString *pathForFile;

if ([fileManager fileExistsAtPath:pathForFile]){ 

}

这篇关于目标c,检查文件存在于路径中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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