开发者

Get iPhone contacts phone number type

开发者 https://www.devze.com 2022-12-21 09:45 出处:网络
I am able to get the phone no of any contact from following code NSLog(@\"%@\",ABMultiValueCopyValueAtIndex(ABRecordCopyValue(ref,kABPersonPhoneProperty) ,0));

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(re开发者_运维问答f,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).

Please suggest how can I identify the type of any number?


Try ABMultiValueCopyLabelAtIndex, this will give you the type of the phone number


 ABMultiValueRef phoneProperty = ABRecordCopyValue(person,kABPersonPhoneProperty); 

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

精彩评论

暂无评论...
验证码 换一张
取 消