• 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: Core Data question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data question


  • Subject: Re: Core Data question
  • From: Chris Hanson <email@hidden>
  • Date: Sun, 10 Aug 2008 20:30:22 -0700

On Aug 10, 2008, at 6:51 PM, Graham Perks wrote:

I do this, where I have an EventImage that refers back to a main Event, "self" is the managed object for the Event, which is your Account:


// create new EventImage, this would be akin to your AccountDetails
imageHolder = (EventImage*)
[NSEntityDescription insertNewObjectForEntityForName:@"EventImage"
inManagedObjectContext: [self managedObjectContext]];


[imageHolder setImage:image]; // set some data in the new object

// Add reference from Event to it's Image
[self setValue:imageHolder forKey:@"imageHolder"];

// Add the reverse relationship, from the image back to the event.
[imageHolder setValue:self forKey:@"event"];

If your Event.imageHolder and EventImage.event relationships are inverses of each other, you should not need to do a thing to ensure that the other is set after doing the first. That's what marking relationships as inverses means; Core Data will set them for you automatically.


  -- Chris

_______________________________________________

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: Core Data question
      • From: Graham Perks <email@hidden>
References: 
 >Core Data question (From: Sandro Noel <email@hidden>)
 >Re: Core Data question (From: Chris Hanson <email@hidden>)
 >Re: Core Data question (From: Negm-Awad Amin <email@hidden>)
 >Re: Core Data question (From: Sandro Noel <email@hidden>)
 >Re: Core Data question (From: Graham Perks <email@hidden>)

  • Prev by Date: Why use NSObjectController?
  • Next by Date: Re: Core Data question
  • Previous by thread: Re: Core Data question
  • Next by thread: Re: Core Data question
  • Index(es):
    • Date
    • Thread