How do I send SMS without launching Text application?

Posted by Thomas on Stack Overflow See other posts from Stack Overflow or by Thomas
Published on 2010-04-11T22:53:12Z Indexed on 2010/04/11 23:03 UTC
Read the original article Hit count: 420

Filed under:
|
|

Hello all:

I am developing a simple application which has to send an SMS message from the app itself instead of launching the native Text app.

Here's my action now. What should I change to achieve my desired functionality?

-(IBAction)startButtonPressed
{
    NSString *phoneNumber = @"13136296693";
    NSString *url           = [NSString stringWithFormat: @"sms:%@",phoneNumber];
    NSLog(@"Send SMS to: %@ ", url); 
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}

Thanks!

Thomas

© Stack Overflow or respective owner

Related posts about xcode

Related posts about iphone-sdk-3.0