Skip navigation.
 
mlKVO autonotifying complaining about custom setter return value
FROM : Jim Turner
DATE : Tue Mar 04 17:49:55 2008

Hi List,

In attempting to use a custom setter for a object, I'm getting the
following message in the console the first time that object is
instantiated:

KVO autonotifying only supports -set<Key>: methods that return void.
Autonotifying will not be done for invocations of -[MyObject
setValue:]

The setter is returning void and both setter and getter are working as
expected, so I'm not sure where this is coming from.  My object looks
like this:

@interface MyObject : MyObjectSuper
{
   id value;
}

@property (assign, setter=setValueForBindings:) id value;
-(void) setValueForBindings:(id)_value;

@end

@implementation MyObject

@dynamic value;

- (id) value
{
   return( value );
}

-(void) setValueForBindings:(id)_value
{
   [self willChangeValueForKey:@"value"];
   {
       BOOL didSetOK = [self setStringValue:(NSString *)_value];
                // Do something with didSetOK
   }
   [self didChangeValueForKey:@"value"];
}
@end


>From what I can tell from the documentation, this is all perfectly

valid.  I even tried removing the method that returns a value inside
the setter to see if that was the problem and it didn't change
anything.  Is this a bug or am I just missing something?

Thanks

--
Jim
http://nukethemfromorbit.com