Reputation: 17160
In my app I need to get a bunch of contact details, I can successfully get things like first and last name like so:
NSString *firstName = (__bridge NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
However I can't get any phone numbers of address details like this, any help in doing would be much appreciated, thanks.
Upvotes: 2
Views: 233
Reputation: 726479
A person has only one name, but might have multiple phone numbers. You need to get all known phones, like this:
ABMultiValueRef allPhones = ABRecordCopyValue(person, kABPersonPhoneProperty);
Then you can look for a specific number (home, work, mobile, etc.) inside the ABMultiValueRef
. Same goes for the address.
Here is a good answer demonstrating the technique; it's pre-ARC, so naturally you will need to add __bridge
to the casts.
Upvotes: 1