views:

392

answers:

2

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

+2  A: 

If I'm not mistaken I think sending text messages via your own application is only available in the iPhone 4.0 SDK.

Jack Marchetti
Thanks for the reply!
Thomas
+1  A: 

Can't be done with the current SDK. I believe Apple announced that applications in iPhone OS 4.0 will be able to do this, using a similar interface to the existing MFMailComposeViewController malarkey.

Noah Witherspoon
Thanks! I'll check into that now.
Thomas