Re: Why is compiler warning for +setKeys:triggerChangeNotificationsForDependentKey: ??
Re: Why is compiler warning for +setKeys:triggerChangeNotificationsForDependentKey: ??
- Subject: Re: Why is compiler warning for +setKeys:triggerChangeNotificationsForDependentKey: ??
- From: Roland King <email@hidden>
- Date: Wed, 21 Apr 2010 10:16:22 +0800
http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/KeyValueObserving/Concepts/DependentKeys.html#//apple_ref/doc/uid/20002179-SW3
It's very deprecated, that documentation splits into Mac OS X 10.5 and
later and Mac OS X 10.4 and earlier.
http://developer.apple.com/mac/library/documentation/cocoa/Reference/Foundation/Protocols/NSKeyValueObserving_Protocol/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/doc/uid/20002299-BBCHIBID
That's the deprecated methods from NSKeyValueObserving.
Either way I still don't see why you'd get a method potentially not
found warning, I'd expect a deprecation warning.
Steve Cronin wrote:
Graham;
Directly from the current Apple docs:Key-Value Observing Programming Guide
No mention of deprecation…
Registering Dependent Keys
It’s common that the value of one property of a class is dependent on the value of another property of the same class. Key-value observing provides a lightweight method of declaring these dependencies through the use of the class method setKeys:triggerChangeNotificationsForDependentKey:.
The setKeys:triggerChangeNotificationsForDependentKey: class method specifies an array of keys that will cause a change notification to be triggered for the dependent key.
Consider the case of a method that returns a person’s full name by combining the first and last names. The fullNameproperty is dependent on both the firstName property and the lastName property. Anytime the value of firstName orlastName changes, an observer notification must be sent for the fullName property. The example in Listing 1 registers this dependency and implements the accessor method for the fullName, firstName and lastName properties.
Listing 1 Registering a dependent key
+ (void)initialize {
[self setKeys:[NSArray arrayWithObjects:@"firstName",@"lastName",nil]
triggerChangeNotificationsForDependentKey:@"fullName"];
}
On Apr 20, 2010, at 8:53 PM, Graham Cox wrote:
On 21/04/2010, at 11:48 AM, Steve Cronin wrote:
I'm seeing compiler warnings -> : warning: 'ABC' may not respond to '+setKeys:triggerChangeNotificationsForDependentKey:'
What have I overlooked?
As a method that has been deprecated for a long time, perhaps it's no longer being included in the headers of your current SDK?
--Graham
_______________________________________________
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
_______________________________________________
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