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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.