I want to create a directory inside my SupportDirectory application. I understand that applicationSupportDirectory does not allow users to see data inside. That's why I chose it. However, the code I use below seems to fail, and I'm not sure why.
Can someone tell me what I did wrong? Thanks!
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); NSString *applicationDirectory = [paths objectAtIndex:0]; // Get directory NSString *dataPath = [applicationDirectory stringByAppendingPathComponent:@"drawings"]; if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath]){ NSError* error; if([[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:&error]) ;// success else { NSLog(@"Failed"); } } }
source share