MFMessageComposeViewController: how to restrict sending messages as cellular messages not as iMessage

I use MFMesageComposeViewController to send a message, this creates problems for me.

when I send a message to multiple recipients, it works great if iMessages is enabled or disabled. But when I send a message to one contact and iMessages are activated from the settings, it gives me a "Delivery Error" in the message application and shows it as iMessage .

How can I get MFMessageComposeViewController to send it as a cell message.

My code is:

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

In short, you cannot. If iMessage is enabled on the device and the recipient is available as an iMessage client, the message will be sent as iMessage. This behavior is determined by iOS itself; you cannot change it.

+2
source

Apple does not provide any methods to determine if a message is sent as "iMessage" or "SMS."

In addition, your message will not be sent as iMessage if you are not connected to the Internet. If you have a slow Internet connection, your message will be automatically sent as SMS.

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

+1
source

Source: https://habr.com/ru/post/1468903/


All Articles