I am trying to create a new directory, and it should be way easier than this. I’ve looked at numerous tutorials, and am virtually copy and pasting the code, but I’m getting an error “use of undeclared identifier createDirectoryAtPath” each time. Here is my code:
NSFileManager *filemgr;
NSArray *dirPaths;
NSString *docsDir;
NSString *newDir;
filemgr =[NSFileManager defaultManager];
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
newDir = [docsDir stringByAppendingPathComponent:@"pdf"];
if ([createDirectoryAtPath:newDir withIntermediateDirectories:YES attributes:nil error: NULL] == NO)
{
// Failed to create directory
}
[filemgr release];
Any help would be appreciated.
Edit: I should mention I have this code in the .m file, within -(void)viewDidLoad
You have to call createDirectoryAtPath: on the filemanager