我想从我的联系人那里获取一个选定个人的地址。
我正在使用ABPeoplePickerNavigationController
和这种委托方法在选择某人时获取电子邮件和姓名等数据:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
但是,如何获得一个人的地址(或者一个人的多个地址,如果他们有多个地址)?我需要单独获取每个地址并分成几部分,如地址行1,2,城市,州,邮政编码,国家/地区。
在这里你如何获得该人的地址属性。
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)
peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier{
NSString *string = (NSString*)ABRecordCopyValue(person, AddressPropertyHere);
}
地址属性常量列表:
const ABPropertyID kABPersonAddressProperty;
const CFStringRef kABPersonAddressStreetKey;
const CFStringRef kABPersonAddressCityKey;
const CFStringRef kABPersonAddressStateKey;
const CFStringRef kABPersonAddressZIPKey;
const CFStringRef kABPersonAddressCountryKey;
const CFStringRef kABPersonAddressCountryCodeKey;