Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);
like image 559
user1007895 Avatar asked Dec 06 '22 17:12

user1007895


1 Answers

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);
}
like image 178
user1007895 Avatar answered May 08 '23 02:05

user1007895