• 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: 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


  • Follow-Ups:
    • Re: CoreData: Can't modify an immutable model
      • From: "Sean McBride" <email@hidden>
  • Prev by Date: NSArrayController & NSTableView selectionIndexes bug
  • Next by Date: Re: CoreData: Can't modify an immutable model
  • Previous by thread: Re: NSArrayController & NSTableView selectionIndexes bug
  • Next by thread: Re: CoreData: Can't modify an immutable model
  • Index(es):
    • Date
    • Thread