Re: Core Data: right way to gather all elements of a to-many relationship?
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