草庐IT

iphone - MFMessageComposeViewController:如何限制以蜂窝消息而不是 iMessage 的形式发送消息

coder 2023-09-28 原文

我使用 MFMesageComposeViewController 发送消息,这给我带来了问题。

当我向多个收件人发送消息时,无论 iMessages 是从设置中启用还是禁用,它都可以正常工作。但是,当我向单个联系人发送消息并且从设置中启用了 iMessages 时,它会在 Message App 中显示 “传递失败” 并将其显示为 iMessage.

我如何强制 MFMessageComposeViewController 将其作为蜂窝消息发送。

我的代码是:

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

最佳答案

简而言之 - 你不能。如果设备上启用了 iMessage 且收件人可用作 iMessage 客户端,则消息将作为 iMessage 发送。此行为由 iOS 本身定义,您无法更改。

关于iphone - MFMessageComposeViewController:如何限制以蜂窝消息而不是 iMessage 的形式发送消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15379180/

有关iphone - MFMessageComposeViewController:如何限制以蜂窝消息而不是 iMessage 的形式发送消息的更多相关文章

随机推荐