Re: Core Data: Custom to-many relationship setter not being invoked
Re: Core Data: Custom to-many relationship setter not being invoked
- Subject: Re: Core Data: Custom to-many relationship setter not being invoked
- From: Jerry Krinock <email@hidden>
- Date: Mon, 22 Feb 2010 15:21:11 -0800
On 2010 Feb 22, at 14:59, Ken Tabb wrote:
> My problem is that Department's custom -awakeFromInsert gets called, yet its -addEmployeesObject and -addEmployees methods don't ever get called. If I add employees in the app
I believe that Core Data does a wholesale replacement. Try overriding -setEmployees: and see if that works. Just as if it were a regular attribute. Something like this method I use:
- (void)setTriggers:(NSSet*)value {
[self postWillSetNewTriggers:value] ;
[self willChangeValueForKey:constKeyTriggers];
[self setPrimitiveTriggers:[NSMutableSet setWithSet:value]];
[self didChangeValueForKey:constKeyTriggers];
}
If this works, do not delete your other custom setters, because you don't know how Core Data may decide to mutate the set in Mac OS 10.7. It's an "implementation detail".
Also, consider observing the value using KVO, instead of custom setters.
_______________________________________________
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