我正在尝试从我的联系人那里获取一个选定个人的地址。
我正在使用ABPeoplePickerNavigationController
和此委托方法在选择某人时获取电子邮件和姓名等数据:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
但是,我怎样才能获得一个人的地址(或者一个人的多个地址,如果他们有多个地址)?我需要单独获取每个地址并分成几部分,例如地址行1,2,城市,州,邮政编码,国家。
答案 0 :(得分:0)
这里是如何获得此人的地址属性的。
- (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;