teepusink
teepusink

Reputation: 28892

How do I supply the message text when sending SMS using the sms schema?

How do I open SMS from my app and have the new message popped up and prepopulated?

Right now this is what I have
NSString *stringURL = @"sms:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

That opens the SMS app but you have to click on new message etc.

Thanks,
Tee

Upvotes: 1

Views: 379

Answers (2)

Samer
Samer

Reputation: 21

of course its supplied and supported by the public API.

here you go:

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];
}

Upvotes: 2

zoul
zoul

Reputation: 104065

You can include a number in the URL to start writing a message to it. Supplying the message text is not supported by the public API (as far as I know).

Upvotes: 1

Related Questions