user1007895 user1007895 - 2 months ago 27
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);


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);