ABPerson does not have interface properties ?

  • This one has to be pretty simple.
    There is a category of ABPerson which provides this interface. So what have I missed ?
    OSX, 10.7

    #import "RSAppDelegate.h"
    #import <AddressBook/AddressBook.h>
    #import <AddressBook/ABPerson.h>

    @implementation RSAppDelegate

    - (void)applicationDidFinishLaunching:(NSNotification *) notification {

    addressBook = [ABAddressBook addressBook];
    // this line works and loads 81 records into the content array...
    // [peopleArrayController setContent:[addressBook people]];


    for(ABPerson * person in [addressBook people]) {

      NSArray * props = [person properties];  // No visible @interface for 'ABPerson' declares the selector 'properties'

      NSMutableDictionary * d = [[NSMutableDictionary alloc] init];
      for( NSString * propName in props ) {
      [d setObject:[person valueForProperty:propName] forKey:propName];
      }
      [peopleArrayController addObject:d];
    }

    NSLog(@"%s- [%04d] Number of people records loaded:  %lu", __PRETTY_FUNCTION__, __LINE__, [[peopleArrayController content] count]);
    }

    @end
  • My mistake.  'properties' is a class method, returning the keys; not an instance method, as I was using it below.

    On 2012-07-14, at 7:01 PM, Erik Stainsby <erik.stainsby...> wrote:

    > This one has to be pretty simple.
    > There is a category of ABPerson which provides this interface. So what have I missed ?
    > OSX, 10.7
    >
    >
    > #import "RSAppDelegate.h"
    > #import <AddressBook/AddressBook.h>
    > #import <AddressBook/ABPerson.h>
    >
    > @implementation RSAppDelegate
    >
    > - (void)applicationDidFinishLaunching:(NSNotification *) notification {
    >
    > addressBook = [ABAddressBook addressBook];
    > // this line works and loads 81 records into the content array...
    > //    [peopleArrayController setContent:[addressBook people]];
    >
    >
    > for(ABPerson * person in [addressBook people]) {
    >
    > NSArray * props = [person properties];        // No visible @interface for 'ABPerson' declares the selector 'properties'
    >
    > NSMutableDictionary * d = [[NSMutableDictionary alloc] init];
    > for( NSString * propName in props ) {
    > [d setObject:[person valueForProperty:propName] forKey:propName];
    > }
    > [peopleArrayController addObject:d];
    > }
    >
    > NSLog(@"%s- [%04d] Number of people records loaded:  %lu", __PRETTY_FUNCTION__, __LINE__, [[peopleArrayController content] count]);
    > }
    >
    > @end
previous month july 2012 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