• 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: How to create subentity object inheriting from superentity object in core data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create subentity object inheriting from superentity object in core data


  • Subject: Re: How to create subentity object inheriting from superentity object in core data
  • From: Leon Starr <email@hidden>
  • Date: Wed, 16 Sep 2009 11:16:45 -0700

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 <email@hidden> 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 (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


References: 
 >How to create subentity object inheriting from superentity object in core data (From: Leon Starr <email@hidden>)
 >Re: How to create subentity object inheriting from superentity object in core data (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: settings to build for 10.5 on 10.6?
  • Next by Date: Re: How to create subentity object inheriting from superentity object in core data
  • Previous by thread: Re: How to create subentity object inheriting from superentity object in core data
  • Next by thread: Re: How to create subentity object inheriting from superentity object in core data
  • Index(es):
    • Date
    • Thread