• 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: Adding to-many objects programmatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding to-many objects programmatically


  • Subject: Re: Adding to-many objects programmatically
  • From: mmalc Crawford <email@hidden>
  • Date: Fri, 15 Jan 2010 22:13:49 -0800

On Jan 15, 2010, at 10:00 pm, Jenny M wrote:

> I guess my question is also, was there any easier way to do it?? Is that how
> it's normally done?
>
It's not clear exactly what you're referring to.
Do you mean, is the typical pattern that which you described earlier, namely:

> I've been setting it using key-value coding: [object setValue:mySet
> forKey:categories]
>

No, that's not how the documentation recommends that you do it.

"Core Data automatically generates efficient public and primitive get and setaccessor methods for modeled properties (attributes and relationships) of managed object classes (see “Managed Object Accessor Methods”). When you access or modify properties of a managed object, you should use these methods directly."

[...]

"Typically, however, you do not want to set an entire relationship, instead you want to add or remove a single element at a time. To do this, you should use mutableSetValueForKey: or one of the automatically-generated relationship mutator methods (see “Dynamically-Generated Accessor Methods”):"

mmalc

_______________________________________________

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: Adding to-many objects programmatically
      • From: Jenny M <email@hidden>
References: 
 >Adding to-many objects programmatically (From: Jenny M <email@hidden>)
 >Re: Adding to-many objects programmatically (From: Jenny M <email@hidden>)

  • Prev by Date: Re: Adding to-many objects programmatically
  • Next by Date: Re: Scrolling [SOLVED]
  • Previous by thread: Re: Adding to-many objects programmatically
  • Next by thread: Re: Adding to-many objects programmatically
  • Index(es):
    • Date
    • Thread