NSArrayController Key-Value Observing

  • I am trying to track the selections of an NSArrayController.  I set up
    an observer for the selectedObjects property of the NSArrayController
    but when I get to observeValueForKeyPath and print the description of
    the (NSDictionary *)change argument, I get null for the old value. I
    was expecting to get an NSArray.  Why am I not getting the proper value?

    GDB output:
    Printing description of change:
    <CFDictionary 0x1497c0 [0xa07311a0]>{type = mutable, count = 2,
    capacity = 3, pairs = (
    0 : <CFString 0xa01c6658 [0xa07311a0]>{contents = "kind"} = <CFNumber
    0x10e8e0 [0xa07311a0]>{value = +1, type = kCFNumberSInt32Type}
    2 : <CFString 0xa01c6638 [0xa07311a0]>{contents = "old"} = <CFNull
    0xa0731020 [0xa07311a0]>
    )}

    Thanks in advance,
    Paul
  • On Jan 10, 2008, at 6:33 PM, Paul De Vera wrote:

    > I am trying to track the selections of an NSArrayController.  I set
    > up an observer for the selectedObjects property of the
    > NSArrayController but when I get to observeValueForKeyPath and print
    > the description of the (NSDictionary *)change argument, I get null
    > for the old value. I was expecting to get an NSArray.  Why am I not
    > getting the proper value?
    >
    <http://homepage.mac.com/mmalc/CocoaExamples/controllers.html>

    mmalc
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today