I would like to list all the phone numbers (or any other field) of people in the address book.
I wrote the following code:
- (void)addressBookFill{
ABAddressBookRef addressBook = ABAddressBookCreate();
people = (NSArray*)ABAddressBookCopyArrayOfAllPeople(addressBook);
[addressBook release];
}
- (void)printAddressBook{
for(id person in people){
NSLog(@"%@", [person class]);
NSLog(@"\t%@", person );
}
}
When I call the printAddressBook method, I get this on my console:
2010-07-06 10:34:11.998 app[91420:207] __NSCFType
2010-07-06 10:34:11.999 app[91420:207] <CPRecord: 0x5d56ce0 ABPerson>
And I have no idea how to dereference this ABPerson object, how to get any information from it.
I tried:
firstName = ABRecordCopyValue(person, kABPersonFirstNameProperty);
but I have some exceptions.
Can someone tell me how to get information from these objects?
source
share