Re: NSManagedObjectModel initWithContentsOfURL: returns nil
Re: NSManagedObjectModel initWithContentsOfURL: returns nil
- Subject: Re: NSManagedObjectModel initWithContentsOfURL: returns nil
- From: Chris Hanson <email@hidden>
- Date: Thu, 16 Oct 2008 14:48:39 -0700
On Oct 16, 2008, at 2:33 PM, Todd Blanchard wrote:
I've been trying to open this core data model all day. XCode can
open it.
I'm passing the path the the model file as a file path parameter.
NSManagedObjectModel* model = [[NSManagedObjectModel
alloc]initWithContentsOfURL:[NSURL fileURLWithPath:modelFile]];
The path is /Users/todd/Projects/MyProjectGroup/MyProject/
BusinessModel.xcdatamodel/
What you're trying to open is an Xcode data model, which Xcode can
compile into a Core Data managed object model (".mom") file. Core
Data can't read Xcode data model files directly.
In part, this is because Xcode data model files are allowed to be
inconsistent for development convenience -- for example, they can have
relationships with no destination entity set -- while Core Data
managed object model files require a minimum amount of consistency.
Xcode's model compiler will generate warnings and errors to enforce
that consistency during model compilation.
-- Chris
_______________________________________________
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