【问题标题】:How do I supply the message text when sending SMS using the sms schema?使用 sms 模式发送 SMS 时如何提供消息文本?
【发布时间】:2011-02-05 13:46:31
【问题描述】:

如何从我的应用打开 SMS 并弹出并预填充新消息?

现在这就是我所拥有的
NSString *stringURL = @"sms:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

这会打开 SMS 应用程序,但您必须点击新消息等。

谢谢,
三通

【问题讨论】:

标签: iphone sms


【解决方案1】:

当然它由公共 API 提供和支持。

给你:

MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
if([MFMessageComposeViewController canSendText])
{
    controller.body = @"The text you want to populate in the SMS";
    controller.recipients = tempArrayForSMS;// any NSMutable Array holding numbers
    controller.messageComposeDelegate = self;
    [self presentModalViewController:controller animated:YES];
}

【讨论】:

  • 是的,从 iOS 4.0 开始。在发布答案时,它是正确的。
【解决方案2】:

您可以在 URL 中包含一个数字以开始向其写入消息。公共 API 不支持提供消息文本(据我所知)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-26
    • 1970-01-01
    • 2013-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多