Search code examples
iphoneiosobjective-cxcodemfmessagecomposeviewcontroller

MFMessageComposeViewController: How to restrict to send message as Cellular Message not as iMessage


I use MFMesageComposeViewController to send message it is creating problems for me.

when i send message to multiple recipients it works fine whether iMessages are Enable or disable from settings. But when i send message to single contact and and iMessages are enable from settings it gives me "Delivery failed" in Message App and show it as iMessage.

How can i force MFMessageComposeViewController to send it as Cellular Message.

My Code is:

[[[MFMessageComposeViewController alloc] init] autorelease];
if ([MFMessageComposeViewController canSendText]) {
    controller.body = @"Sample Text Message";
    controller.recipients = [NSArray arrayWithObject:@"XXXXXXXXXXXX"];
    controller.messageComposeDelegate = self;
    }

Solution

  • In short - you can't. If iMessage is enabled on a device and recipient is available as iMessage client, the message WILL be sent as iMessage. This behaviour is defined by iOS itself, you can't change it.