bugGNUstep - Bugs: bug #41325, KVO: +[NSObject...


bug #41325: KVO: +[NSObject keyPathsForValuesAffecting<Key>] not supported

Submitter:  Frederik <triplef>
Submitted:  Thu 23 Jan 2014 06:18:36 PM UTC
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  None Status:  In Progress
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Sun 26 Jan 2014 01:52:18 PM UTC, comment #3: 

Thank you for spotting this bug. I committed you suggested fix.

As for the real change I hope that Richard is taking this up, I might put it in the wrong place.

Fred Kiefer <FredKiefer>
Group Member
Sun 26 Jan 2014 01:46:24 PM UTC, comment #2: 

Thanks for the quick fix. Your suggestion about calling -keyPathsForValuesAffectingXXX: when registering an observer sounds like a good solution to me, as the result from these methods is unlikely to change and Apple doesn’t document at which times/intervals they are called either.

One thing I noticed in your change - I think 'dependentKey' should be capitalized here (i.e. [dependentKey capitalizedString]):

> NSString *selString = [NSString stringWithFormat: @"keyPathsForValuesAffecting%@",


Frederik <triplef>
Sun 26 Jan 2014 01:30:37 PM UTC, comment #1: 

I just implemented the method keyPathsForValuesAffectingValueForKey, but the result may not be as expected.

The current implementation of KVO in GNustep does not call this method when a key gets observed to determine which which key paths affect which others. I think fixing this would require an almost complete rewrite of the KVO implementation.

What we could do to get a similar result would be to add calls to the keyPathsForValuesAffectingXXX: methods when a new observer gets added and fix the values in dependentKeyTable to reflect those connections.

Fred Kiefer <FredKiefer>
Group Member
Thu 23 Jan 2014 06:18:36 PM UTC, original submission:  

This is a kind request to add support for +keyPathsForValuesAffecting<Key> / +keyPathsForValuesAffectingValueForKey: on NSObject.

Currently only the older +setKeys:triggerChangeNotificationsForDependentKey: is supported to register dependent keys, which Apple deprecated in OS X 10.5.


Frederik <triplef>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by FredKiefer (Posted a comment)
  • -email is unavailable- added by triplef (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-26 FredKiefer StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code