1

I'm trying to figure out what kind (home, mobile, fax and so on) of phone number but I can't figure out how to do it with the ABMultiValueRef. I can get the types by doing:

CFStringRef cfLabel = ABMultiValueCopyLabelAtIndex(multiValueRef, i);

NSString *label = (__bridge NSString*) cfLabel;

NSLog(@"%@", label); // prints i.e "_$!<Mobile>!$_"

CFRelease(cfLabel);

So while it prints _$!<Mobile>!$_ I can do some IF-logic to check if the label equals _$!<Mobile>!$_ but what about in the future if Apple decides to change the value of the Mobile label? For me it would feel so much better to have a constant I can check against. But I can't find any to use?

Peter Warbo
  • 11,136
  • 14
  • 98
  • 193

2 Answers2

2

These CFStringRef constants are defined in AddressBook framework (ABPerson.h to be precise):

kABPersonPhoneMobileLabel
kABPersonPhoneIPhoneLabel
kABPersonPhoneMainLabel
kABPersonPhoneHomeFAXLabel
kABPersonPhoneWorkFAXLabel
kABPersonPhoneOtherFAXLabel
kABPersonPhonePagerLabel

In particular, kABPersonPhoneMobileLabel has the _$!<Mobile>!$_ value.

Please refer to ABPerson reference for more info about these and other constants defined by the AddressBook framework.

Egor Chiglintsev
  • 1,252
  • 10
  • 9