简体   繁体   English

获取iPhone联系人电话号码类型

[英]Get iPhone contacts phone number type

I am able to get the phone no of any contact from following code 我可以通过以下代码获取任何联系电话

NSLog(@"%@",ABMultiValueCopyValueAtIndex(ABRecordCopyValue(ref,kABPersonPhoneProperty) ,0));
        NSLog(@"%@",ABMultiValueCopyValueAtIndex(ABRecordCopyValue(ref,kABPersonPhoneProperty) ,1));
        NSLog(@"%@",ABMultiValueCopyValueAtIndex(ABRecordCopyValue(ref,kABPersonPhoneProperty) ,2));
        NSLog(@"%@",ABMultiValueCopyValueAtIndex(ABRecordCopyValue(ref,kABPersonPhoneProperty) ,3));
        NSLog(@"%@",ABMultiValueCopyValueAtIndex(ABRecordCopyValue(ref,kABPersonPhoneProperty) ,4));

but from above code I does not identify which phone number is related to which one (for ex- mobile, home, main, iPhone etc). 但从上面的代码我不知道哪个电话号码与哪个(与移动电话,家庭,主要,iPhone等)相关。

Please suggest how can I identify the type of any number? 请建议我如何识别任何数字的类型?

尝试ABMultiValueCopyLabelAtIndex ,这将为您提供电话号码的类型

 ABMultiValueRef phoneProperty = ABRecordCopyValue(person,kABPersonPhoneProperty); 

for(int i=0;i<[array count];i++)
{
  NSString* phoneLabel = (NSString*) ABAddressBookCopyLocalizedLabel(ABMultiValueCopyValueAtIndex(phoneProperty,i)
  NSLog(@"%@",phoneLabel);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM