Re: NSFileManager - Incompatible persistent store
Re: NSFileManager - Incompatible persistent store
- Subject: Re: NSFileManager - Incompatible persistent store
- From: Graham Cox <email@hidden>
- Date: Mon, 26 Nov 2012 11:16:52 +1100
On 26/11/2012, at 9:44 AM, Tom Miller <email@hidden> wrote:
> Thank you! Though this didn't quite work. I'm getting an error response in
> the code telling me "No visible @interface for 'NSFileManger' declares the
> selector 'createDirectoryAtURL:attributes'. Included in this message is the
> code im playing with,
So, have you actually tried Sean's suggestion of using -createDirectoryAtURL:withIntermediateDirectories:attributes:error: ? You should also make your method -applicationSupportFolder return a NSURL not a path string.
There's no good reason for new code to be using a deprecated method, and sticking with paths instead of URLs is not a good long-term strategy. I've just spent a lot of time moving a bunch of older code from path strings to URLs and it's a lot of work, so unless you have to support a much older version of OS X, use NSURL now.
Also, as suggested, checking for the existence of the folder before trying to create it is considered a bad design pattern these days - the method will create the directory IF NECESSARY, and if not (i.e. it exists already) will gracefully return without error.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden