I am trying to find out if a document exists by running
NSString *DocumentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *theFile = [[DocumentPath stringByAppendingPathComponent:FileName] retain];
NSLog(@"File : %@",theFile);
NSLog(@"FileName : %@", FileName);
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:theFile];
NSLog(@"FileExists : %@", fileExists);
I know that the document is there, but I want to run this to find out and if say its been deleted are something then do something else. But all I get as my NSLog is
FileExists : (null)
I have looked at some tutorials and they say this is right. I’m I missing something?
This code work for me. saving file in
Resources->file.txt