1

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

zoul
  • 102,279
  • 44
  • 260
  • 354
teepusink
  • 27,444
  • 37
  • 107
  • 147
  • possible duplicate of http://stackoverflow.com/questions/2084212/sms-body-in-iphone-sdk – zoul Apr 08 '10 at 06:13

2 Answers2

2

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];
}
Samer
  • 21
  • 3
1

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).

zoul
  • 102,279
  • 44
  • 260
  • 354