Skip navigation.
 
mlRe: CoreData: Can't modify an immutable model
FROM : Ben Trumbull
DATE : Tue Feb 05 22:50:52 2008

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

Related mailsAuthorDate
mlRe: CoreData: Can't modify an immutable model Ben Trumbull Feb 5, 22:50
mlRe: CoreData: Can't modify an immutable model Sean McBride Feb 5, 23:04
mlRe: CoreData: Can't modify an immutable model Ben Trumbull Feb 5, 23:18