从联系人获取多个地址? (ABRecordRef)

问题描述 投票:0回答:1

我想从我的联系人那里获取一个选定个人的地址。

我正在使用ABPeoplePickerNavigationController和这种委托方法在选择某人时获取电子邮件和姓名等数据:

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

但是,如何获得一个人的地址(或者一个人的多个地址,如果他们有多个地址)?我需要单独获取每个地址并分成几部分,如地址行1,2,城市,州,邮政编码,国家/地区。

iphone objective-c ipad contacts abrecord
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;
© www.soinside.com 2019 - 2024. All rights reserved.