user1007895 user1007895 - 1 year ago 92
iOS Question

How to get street address from ABPeoplePickerNavigationController

I need a contact's street address. I know how to get the single value properties, but the street address is a multivalue property. Apple's documentation shows how to set it, but not retrieve it. Any help?

PS: this does not work:

ABRecordCopyValue(person, kABPersonAddressStreetKey);

Answer Source

I just figured it out:

ABMultiValueRef st = ABRecordCopyValue(person, kABPersonAddressProperty);
if (ABMultiValueGetCount(st) > 0) {
    CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(st, 0);
    self.street.text = CFDictionaryGetValue(dict, kABPersonAddressStreetKey);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download