Reputation: 46370
Apple is telling to do so in this document over here, and here.
I'd hate to re-invent the wheel and am sure someone did this already, but I wasn't lucky with Google. Does someone know a blog that points out how to do exactly that?
The problem is, I must create this directory with the app bundle ID name inside Library but only if it does not exist.
Upvotes: 3
Views: 421
Reputation: 25930
I think this is what you are looking for:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *libraryPath = [paths objectAtIndex:0];
NSString *bundlePath = [libraryPath stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]];
if(![[NSFileManager defaultManager] fileExistsAtPath:bundlePath]) {
[[NSFileManager defaultManager] createDirectoryAtPath:bundlePath withIntermediateDirectories:YES attributes:nil error:NULL];
}
Upvotes: 5