• 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: right way to gather all elements of a to-many relationship?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data: right way to gather all elements of a to-many relationship?


  • Subject: Re: Core Data: right way to gather all elements of a to-many relationship?
  • From: Luke Evans <email@hidden>
  • Date: Wed, 11 Feb 2009 12:32:39 -0800


On 11-Feb-09, at 12:16 PM, I. Savant wrote:

How? What does this declaration look like in your classes? I assume you have at least one custom subclass of NSManagedObject specified (for your "Element" entity), based on the code example you gave, but it's important to let us know *how* this is declared.

Indeed it is defined in a subclass of NSManagedObject as:

@property(readonly, retain) NSSet *elements;

It is read only as writing is done via KVC patterned write accessors (i.e. addElementsObject, removeElementsObject).

The implementation does nothing more than:

@dynamic elements;

I'm now defending against the wrong type of receiver representing the relationship by first sending a -count message and only if this is non- zero sending -allObjects.
This seems to be working, though it's an unsatisfactory band-aid applied without true knowledge of how the circumstance is arising.



_______________________________________________

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: right way to gather all elements of a to-many relationship?
      • From: "I. Savant" <email@hidden>
References: 
 >Core Data: right way to gather all elements of a to-many relationship? (From: Luke Evans <email@hidden>)
 >Re: Core Data: right way to gather all elements of a to-many relationship? (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: Running out of memory when adding CGImageRef-to-NSImage frames to QTMovie in NSOperation subclass
  • Next by Date: NSPopupButton in NSTableView header?
  • Previous by thread: Re: Core Data: right way to gather all elements of a to-many relationship?
  • Next by thread: Re: Core Data: right way to gather all elements of a to-many relationship?
  • Index(es):
    • Date
    • Thread