• 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: Addressing Relationships in awakeFromInsert
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Addressing Relationships in awakeFromInsert


  • Subject: Re: Addressing Relationships in awakeFromInsert
  • From: Jim Correia <email@hidden>
  • Date: Wed, 10 Aug 2005 16:37:23 -0400

On Aug 10, 2005, at 4:31 PM, August Trometer wrote:

At no point am I setting the Master object -- this should be done automatically. I'm assuming (maybe incorrectly?) that because of the inverse Relationship set up between the Master and Detail Entities that the "master" Relationship in my Detail object automatically points back to the Master object that it's created within.

If you have defined an inverse relationship, then master will automatically be set by CoreData, but not until the other side of the relationship has been set.


I'm not sure what you mean by created within - since CoreData doesn't have containment, only relationships.

Assuming you've got something going on like below, the details master value won't be set until the primary value has ben set.

If this doesn't help, you'll have to be a little less obtuse about what you are trying to do, and provide a sample and your data model.

@implementation Master

- (void)awakeFromInsert
{
    NSManagedObject    *detail = nil;

detail = [NSEntityDescription insertNewObjectForEntityForName: @"Detail" inManagedObjectContext: [self managedObjectContext]];

    // at this point, [detail valueForKey: @"master"] will be nil

    [self setValue: detail forKey: @"detail"];

    // at this point, [detail valueForKey: @"master"] will be good
}

@end



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Addressing Relationships in awakeFromInsert (From: August Trometer <email@hidden>)
 >Re: Addressing Relationships in awakeFromInsert (From: Jim Correia <email@hidden>)
 >Re: Addressing Relationships in awakeFromInsert (From: August Trometer <email@hidden>)

  • Prev by Date: Re: Question about Threading
  • Next by Date: Re: NSBrowser_NSTextView
  • Previous by thread: Re: Addressing Relationships in awakeFromInsert
  • Next by thread: Re: Addressing Relationships in awakeFromInsert
  • Index(es):
    • Date
    • Thread