开发者

How do I send SMS without launching Text application?

开发者 https://www.devze.com 2022-12-26 05:06 出处:网络
I am developing a simple application which has to send an SMS message from the app itself instead of launching the native Text app.

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]];开发者_Go百科
}

Thanks!

Thomas


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


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.


Here's what apple says:

https://web.archive.org/web/20140604143837/http://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/SystemMessaging_TopicsForIOS/Articles/SendinganSMSMessage.html

Here's a tutorial fon another forum.

http://iosdevelopertips.com/core-services/how-to-send-an-sms-progammatically.html

It's still not entirely automated. The user has to tap the send button. I haven't gotten it working yet. Tell me if you have better luck. If you can think of a way for me to program my app to "tap" the send button instead of the user, let me know.

0

精彩评论

暂无评论...
验证码 换一张
取 消