Sowmya Sowmya - 1 year ago 60
Objective-C Question

objective c,checking file exist at path

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).

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?

Answer Source

Can you Please Check NSFileManager.

NSFileManager *fileManager = [NSFileManager defaultManager];

NSString *pathForFile;

if ([fileManager fileExistsAtPath:pathForFile]){