Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can recipients sent to MFMessageComposeViewController be formatted to show name instead of phone number?

When sending email, if I set MFMailComposeViewController recipients using standard RFC822 recipient format with "name" , MFMailComposeViewController will format recipients in the view to show the names with the email addresses hidden. So doing this:

MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];

NSArray *recipients = [NSArray arrayWithObjects:
                           @"\"Bob Paulsen"\ <[email protected]>", 
                           @"\"Sally"\ <[email protected]>", nil
                      ];
[composer setToRecipients:recipients];

results in this: enter image description here

My question is: Is there a magic format I can use to do the same thing in with SMS recipients in MFMessageComposeViewController? I tried using the same format as email but it includes all the text (name and number) in the recipient field. I've tried a few other permutations but so far haven't lucked onto a solution.

like image 766
Kirby Todd Avatar asked Apr 01 '11 13:04

Kirby Todd


1 Answers

The only way to do this would be in add a new contact with the recipient number into the user's address book. See the ABAddressBookAddRecord function in the ABAddressBook framework.

However, make sure your users know that this is happening and are OK with it...

like image 86
tom Avatar answered Oct 20 '22 01:10

tom