0

我正在尝试从我的联系人中获取单个选定个人的地址。

我正在使用ABPeoplePickerNavigationController这个委托方法在选择一个人时获取诸如电子邮件和姓名之类的数据:

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person

但是我怎样才能得到一个人的地址(或者一个人的多个地址应该有多个)?我需要单独获取每个地址并将其分成几部分,例如地址行 1、2、城市、州、邮政编码、国家/地区。

4

1 回答 1

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;
于 2012-09-17T12:47:04.890 回答