문제

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.

도움이 되었습니까?

해결책

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top