• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CoreData: Can't modify an immutable model
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: CoreData: Can't modify an immutable model
      • From: "I. Savant" <email@hidden>
    • Re: CoreData: Can't modify an immutable model
      • From: Jerry Krinock <email@hidden>
References: 
 >CoreData: Can't modify an immutable model (From: Chris Schmitt <email@hidden>)
 >Re: CoreData: Can't modify an immutable model (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: NSOutlineView and reload
  • Next by Date: Re: <ignored selector>
  • Previous by thread: Re: CoreData: Can't modify an immutable model
  • Next by thread: Re: CoreData: Can't modify an immutable model
  • Index(es):
    • Date
    • Thread