Hmm. Does that mean that I only need to create the subclass entity B as shown?

// NSEntityDescription *aEntity = [[model entitiesByName] objectForKey:@"A"]; NSEntityDescription *bEntity = [[model entitiesByName] objectForKey:@"B"];

//A *newA = [[A alloc] initWithEntity:aEntity insertIntoManagedObjectContext:context]; B *newB = [[B alloc] initWithEntity:ATC_Entity insertIntoManagedObjectContext:context];

So now that I have a newB (no pun intended) I can use that to access the superclass attributes just like normal inheritance, right? I'm about to try it anyway, but if it would be helpful to know if this is the correct thinking.

On Sep 16, 2009, at 11:02 , Kyle Sluder wrote:

On Wed, Sep 16, 2009 at 10:53 AM, Leon Starr <leon_st...@modelint.com> wrote:
A is not abstract, so if I create an A NSManagedObject, I need to create and relate a single B or C subclass object. How do I make this happen? I can create the entities, but HOW do I tell the model that object B is a subclass
of object A (or vice versa?)

You don't need to tell it anything. Core Data knows that every B isa A.

--Kyle Sluder


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to