【发布时间】:2011-02-05 13:46:31
【问题描述】:
如何从我的应用打开 SMS 并弹出并预填充新消息?
现在这就是我所拥有的
NSString *stringURL = @"sms:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
这会打开 SMS 应用程序,但您必须点击新消息等。
谢谢,
三通
【问题讨论】:
如何从我的应用打开 SMS 并弹出并预填充新消息?
现在这就是我所拥有的
NSString *stringURL = @"sms:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
这会打开 SMS 应用程序,但您必须点击新消息等。
谢谢,
三通
【问题讨论】:
当然它由公共 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];
}
【讨论】:
您可以在 URL 中包含一个数字以开始向其写入消息。公共 API 不支持提供消息文本(据我所知)。
【讨论】: