Get Multiple Addresses From Contacts? (ABRecordRef)
-
02-07-2021 - |
Pergunta
I am trying to get the address of a single selected individual from my contacts.
I am using ABPeoplePickerNavigationController
and this delegate method to get data like emails and names upon selection of a person:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
But how can I get the address of a person (or multiple addresses of a single person should they have more than one)? I need to get each address individually and broken into parts, like address line 1, 2, city, state, zip code, country.
Solução
here how you get the address property of the person.
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)
peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier{
NSString *string = (NSString*)ABRecordCopyValue(person, AddressPropertyHere);
}
list of address property constants:
const ABPropertyID kABPersonAddressProperty;
const CFStringRef kABPersonAddressStreetKey;
const CFStringRef kABPersonAddressCityKey;
const CFStringRef kABPersonAddressStateKey;
const CFStringRef kABPersonAddressZIPKey;
const CFStringRef kABPersonAddressCountryKey;
const CFStringRef kABPersonAddressCountryCodeKey;
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow