4

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;
    }
Vineet Singh
  • 4,009
  • 1
  • 28
  • 39
M.Shuaib Imran
  • 1,287
  • 16
  • 29

2 Answers2

2

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.

Kyr Dunenkoff
  • 8,090
  • 3
  • 23
  • 21
  • 1
    No i am testing this on those numbers which are not registered as Apple ID or iMessage ID – M.Shuaib Imran Mar 13 '13 at 07:27
  • It doesn't matter. In your code you also can't determine the status of cellphone number - is it iMessage or cellular message only client. – Kyr Dunenkoff Mar 13 '13 at 07:31
  • 1
    I think this may be a bug in the latest version of iOS, as beforehand if I sent an 'SMS' for my train times, it sent an SMS to non iMessage users, now it sends as iMessage regardless of whether the recipient has iMessage or not. I have to go into Messages, and resend as SMS. – Dan Clarke Mar 13 '13 at 13:15
  • @DanClarke, I think you should report that as a bug. – Kyr Dunenkoff Mar 13 '13 at 13:59
  • 1
    I think this is definitely a bug. – Rok Strniša May 26 '13 at 09:26
1

Apple does not provide any methods to detect whether a message is sent as 'iMessage' or 'SMS'.

Also,your message will not be send as iMessage if you are not connected to internet.If you have slow internet connect connectivity,your message will autometically be send as SMS.

If recipient is available as iMessage client and iMessage is enabled on your device then your message will be sent as iMessage. And if at that time,you are not connected to internet,then the 'send' button will be autometically disabled.

Vineet Singh
  • 4,009
  • 1
  • 28
  • 39