小编Bor*_*ris的帖子

如何确定AddressBook FrameWork中的地址类型(iOS 4.2)

我有一个大问题......我打算编写一个处理用户地址簿及其地址的应用程序.一切都很好 - 除了我无法确定addesse的类型是"工作","家"还是"其他"的事实.

有人知道如何获得家庭,工作和其他标签吗?

提前致谢

鲍里斯

这是我目前正在使用的功能:

    + (void)testing {
 //Get the addressbook
 ABAddressBookRef _addressBookRef = ABAddressBookCreate ();

 //Fetch all contacts
 NSArray* allPeople     = (NSArray *)ABAddressBookCopyArrayOfAllPeople(_addressBookRef);

 //Walk the contacts
 for (id record in allPeople) {
  //Get the contact´s id
  NSInteger recordId   = ABRecordGetRecordID((ABRecordRef)record);

  //Get the contact´s name and company
  NSString* recordName  = (NSString *)ABRecordCopyCompositeName((ABRecordRef)record);
  NSString* recordCompany  = (NSString *)ABRecordCopyValue((ABRecordRef)record, kABPersonOrganizationProperty);

  //Get the contact´s addresses
  CFTypeRef adressesReference = ABRecordCopyValue((ABRecordRef)record, kABPersonAddressProperty);
  NSArray *adressesArray  = (NSArray *)ABMultiValueCopyArrayOfAllValues(adressesReference);
  CFRelease(adressesReference);

  NSLog(@"ID:    %d", recordId);
  NSLog(@"Name:  %@", …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c abaddressbook

2
推荐指数
1
解决办法
4255
查看次数

标签 统计

abaddressbook ×1

iphone ×1

objective-c ×1