Re: KVO autonotifying complaining about custom setter return value
Re: KVO autonotifying complaining about custom setter return value
- Subject: Re: KVO autonotifying complaining about custom setter return value
- From: "Kyle Sluder" <email@hidden>
- Date: Tue, 4 Mar 2008 22:10:04 -0500
On Tue, Mar 4, 2008 at 11:49 AM, Jim Turner <email@hidden> wrote:
> 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:]
>
> [snip]
>
> -(void) setValueForBindings:(id)_value
> {
> [self willChangeValueForKey:@"value"];
> {
> BOOL didSetOK = [self setStringValue:(NSString *)_value];
> // Do something with didSetOK
> }
> [self didChangeValueForKey:@"value"];
> }
Please re-read the second sentence of that error again. You are
manually invoking -willChangeValueForKey: and -didChangeValueForKey:
and KVO is complaining "I've already done that!". Either stop doing
that, or implement -automaticallyNotifiesObserversForKey: to return NO
for the "bindings" key.
--Kyle Sluder
_______________________________________________
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