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: "I. Savant" <email@hidden>
- Date: Tue, 5 Feb 2008 11:26:41 -0500
> 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.
Have you tried it? If you create your instance then set its
attributes immediately thereafter, is there a problem?
> 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.
When it's created, it's inserted into the context. Since you're
creating the instance and setting its attributes within the same run
loop, it's not likely to cause you any problems. Again, try it *then*
see if there are any problems. If there are, post the details (and
your code and controller bindings setup) and someone will probably be
able to help you.
> 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.
I think you're probably just inventing a problem that doesn't really
exist. Always try first, then question the results.
--
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