• 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 sub-classing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData sub-classing


  • Subject: Re: CoreData sub-classing
  • From: "Marcus S. Zarra" <email@hidden>
  • Date: Fri, 8 Jun 2007 15:09:35 -0600

Your original message implied that you had Circle and Square classes. If you do not then set the Circle and Square data objects in the model to your GraphicObject as well. Then they will use that class instead of NSManagedObject.

Marcus S. Zarra
Zarra Studios LLC
www.zarrastudios.com
Simply Elegant Software for OS X

On Jun 8, 2007, at 3:05 PM, Steve Israelson wrote:

But I do NOT have any such class.
Are you saying in order to make a custom class you must also then make all the sub-classes?


On 8-Jun-07, at 2:03 PM, Marcus S. Zarra wrote:

Your data model the Circle and Square should be set to the classes they are (Circle and Square), not to NSManagedObject. NSManagedObject is the default and you can set them to any appropriate subclass as you wish.

Marcus S. Zarra
Zarra Studios LLC
www.zarrastudios.com
Simply Elegant Software for OS X

On Jun 8, 2007, at 2:54 PM, Steve Israelson wrote:

I have a CoreData Entity of, say, GraphicObject. It has several sub-class entities in the data model of Circle and Square.
Now, I want to make an Objective-C subclass of GraphicObject to cache the graphic image.
In the data model editor I set the class of GraphicObject to my Objective-C class.
Circle and Square are still set to the class of ManagedObject.


In my code when I add Circle or Square entities to the context, I get an exception of them being the wrong class.
So, hmm, I set their class to my Objective-C too.
I still get exceptions thrown.


So, my question is, HOW do I have a data model that uses inheritance and is also implemented using custom classes in Objective-C?



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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 sub-classing
      • From: Steve Israelson <email@hidden>
References: 
 >CoreData sub-classing (From: Steve Israelson <email@hidden>)
 >Re: CoreData sub-classing (From: Steve Israelson <email@hidden>)

  • Prev by Date: Re: CoreData sub-classing
  • Next by Date: Re: CoreData sub-classing
  • Previous by thread: Re: CoreData sub-classing
  • Next by thread: Re: CoreData sub-classing
  • Index(es):
    • Date
    • Thread