Skip navigation.
 
mlRe: KVO autonotifying complaining about custom setter return value
FROM : Jim Turner
DATE : Wed Mar 05 20:40:29 2008

On Wed, Mar 5, 2008 at 12:00 PM, mmalc crawford <<email_removed>> wrote:
>
>  On Mar 5, 2008, at 9:34 AM, Jim Turner wrote:
>
>  > I filed a bug (rdar://problems/5781977) as this doesn't appear to be
>  > proper behavior.  I'd be happy to be told I'm wrong if you can point
>  > out what I'm missing.
>
>  I believe this behaves correctly.
>  As stated in <http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_5.html#

>  >, "Key-value coding and declared properties are orthogonal
>  technologies."
>  KVC doesn't know about any custom setter you may have defined for a
>  property.
>
>  mmalc
>
>


Hmm, it appears the developer documentation I have locally on my
machine is slightly out of date.  After reading that link (and the
updated description of setter= and getter=), I see now why what I'm
doing isn't working.  Properties and KVO/KVC aren't complimentary to
each other... although it'd be nice if they were.  I'll have to
re-work my object to get it to be properly compliant.

But, I still appear to have an issue with defining a custom
getter/setter.  Defining a property as

@property (setter=mySetMethod:,getter=myMethod) id valueTest;

and sending my object a valueTest message, I get the unrecognized
selector sent to instance warning.  Reading (and re-reading several
times) http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html#//apple_ref/doc/uid/TP30001163-CH17-SW17
it appears that I don't need to define anything other than the
@property but unless I also place

-(id) valueTest;
-(void) setValueTest:(id)_value;

in the interface, the object can't find a method signature.

This is a little more confusing that I originally thought. I
appreciate all the help, though.

--
Jim
http://nukethemfromorbit.com