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: Chris Schmitt <email@hidden>
- Date: Tue, 5 Feb 2008 11:05:12 -0500
I.S.
I am trying to create an "instance" of an entity in my managed
object model, so I can set the attributes before it is added to the
model. Hopefully that makes sense... I was reading that earlier, but
I am confused. If I use the
insertNewObjectForEntityForName:inManagedObjectContext: method then my
instance will be added to the scratch pad. And if I had a table view
bound to an array controller who is bound to that entity the value
would appear before I set my attributes.
I guess what I am trying to do is create the instance
programmatically, set it up how I want it, then add it to the
managedObjectContext. This way no other bound controls see it
before I have setup the correct attributes on it.
Is there a different method I should be using? I am going to re-
read that section again, but I think I am just missing something.
Thanks for the quick reply I.S.
On Feb 5, 2008, at 10:44 AM, I. Savant wrote:
I am trying to create a core data entity using the method
enittyForName: inManagedObjectContext . I can create the entity just
fine but when I try to set one of the attributes I get the following
error:
Can't modify an immutable model
Do you mean you're trying to define a managed object model in code
(versus using XCode's modeler) or you're trying to create an
*instance* of an entity (a managed object) then set its attributes?
The method+entityForName:inManagedObjectContext: "Returns the entity
with the specified name from the managed object model associated with
the specified managed object context's persistent store coordinator."
This is the entity itself (rather, an NSEntityDescription), not an
instance of it.
See this document:
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdCreateMOs.html
--
I.S.
_______________________________________________
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