iphoneioscocoaabmultivalueabperson

Default Phone Number for Texting in ABPerson


I am trying to get the default phone number for sending a text message for an iPhone Address Book contact using ABPerson. I understand that ABMultiValue is to be used. But I cannot find out if there is a way to determine the default text message phone number (or for that manner, the default phone call phone number, email or address). I am about to grab the first object for each, but I am concerned that, for a text message, the phone may be a land line or otherwise unable to receive texts. Any advice on how to approach this matter would be appreciated.


Solution

  • You can extract specific values for home, work and cell phone number from the ABMultiValue. You will probably want to use the value corresponding to kABPersonPhoneMobileLabel and/or kABPersonPhoneIPhoneLabel to send a text message. If neither of those values exist, choose the first available phone number.