2

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.

Josh Kahane
  • 16,765
  • 45
  • 140
  • 253

1 Answers1

1

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.

Community
  • 1
  • 1
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523