How do I send SMS without launching Text application?
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.
精彩评论