Re: CoreData: Can't modify an immutable model
Re: CoreData: Can't modify an immutable model
- Subject: Re: CoreData: Can't modify an immutable model
- From: Ben Trumbull <email@hidden>
- Date: Tue, 5 Feb 2008 13:50:52 -0800
Chris,
I am trying to create a core data entity using the method
enittyForName: inManagedObjectContext .
You want an NSManagedObject, not an NSEntityDescription. Each
managed object *has* an entity description. The entity description
defines the object's properties and caches.
NSManagedObject is to NSEntityDescription what id is to Class
Or for a database analogy, the entity describes the table, and the
managed object describes the row.
No, or maybe only for a few microseconds. I was kind of confused by
this the first time that I used Core Data...
First, you "insert".
Then, you modify.
Seems backwards, but it works. You don't "create" a managed object.
Yes. If you really want to, you can pass nil in for the
NSManagedObjectContext* parameter, and call -insertObject: later.
But there's a limit to how much you can do with a managed object if
it is not registered with a context. For example, inverse
relationship maintenance won't work so you can't set any
relationships.
--
-Ben
_______________________________________________
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