I\'m using KVC/KVO to create a custom bindings implementation for a University project (it needs to be custom as I want to do things beyond what bindings can do, including r
Perhaps put an NSLog
in your addObserver
call, to see if you're adding two observers.
You're doing this:
- (void)setName:(NSString *)name
{
[self willChangeValueForKey:@"name"];
[contact setFirstName:name];
[self didChangeValueForKey:@"name"];
}
But (by the sounds of it) from a non-NSManagedObject
subclass. This means that Cocoa will be attempting to send KVO notifications automatically for you. You're supplementing that by sending your own too. Solutions:
+automaticallyNotifiesObserversForKey:
to return NO
Change your method to:
- (void)setName:(NSString *)name
{
[contact setFirstName:name];
}