Does anybody know if it's possible, and how, to programmatically send a SMS from the iPhone, with the official SDK / Cocoa Touch?

+14  A: 

You can use a sms:[target phone number] URL to open the SMS application, but there are no indications on how to prefill a SMS body with text (see this post on Apple Developer Forums).

+12  A: 


If you could send an SMS within a program on the iPhone, you'll be able to write games that spam people in the background. I'm sure you really want to have spams from your friends, "Try out this new game! It roxxers my boxxers, and yours will be too!!!!! If you sign up now you'll get 3,200 RB points!!"

Apple has restrictions for automated (or even partially automated) SMS and dialing operations. (Imagine if the game instead dialed 911 at a particular time of day)

Your best bet is to setup an intermediate server on the internet that uses an online SMS sending service, and send the SMSs via that route if you need complete automation. (ie, your program on the iPhone sends a UDP packet to your server, which sends the real SMS)

iOS 4 Update

iOS 4, however, now provides a viewcontroller you can import into your application. You prepopulate the SMS fields, then the user can iniaite the SMS send within the controller. Unlike using the "sms:..." url format, this allows your application to stay open, and allows you to populate both the to and the body fields. You can even specify multiple recipients.

This prevents applications from sending automated SMS without the user explicitly aware of it. You still cannot send fully automated SMS from the iPhone itself, it requires some user interaction. But this at least allows you to populate everything, and avoids closing the application.

The MFMessageComposeViewController class is well documented, and tutorials show how easy it is to implement.

Limitations to this class

Keep in mind that this won't work on phones without iOS 4, and it won't work on the iPod touch or the iPad. You must either detect the device and iOS limitations prior to using this controller, or risk restricting your app to recently upgraded 3G, 3GS, and 4 iPhones.

However, an intermediate server that sends SMS will allow any and all of these iOS devices to send SMS as long as they have internet access, so it may still be a better solution for many applications. Alternately, use both, and only fall back to an online SMS service when the device doesn't support it.

Adam Davis
And if you purchase that domain I will never be able to look at you the same way again.
Adam Davis
I think it's ironic that somebody flagged this post as spam. Read between the lines, peoples!
-1 because this reads as speculation. Also, see Jus' Wondrin''s and rydgaze's answers on how to send in-app SMSes.
Frank Shearar
@Frank - Updated my writeup to reflect the new iOS 4 features. Removed wishy-washy wording.
Adam Davis
+1  A: 

Did anyone ever find a solution for this? I am aware of breaking out of the app using an sms: url specifier, however I really would like to pre-populate the contents of the SMS, similar to how is possible using mailto:


Maybe this should be a comment on the question, because it's not an answer.
Frank Shearar

Is there some official statement from Apple about this feature? There is a project called iPhone Delivery Report on Google Code, but it’s only meant for jailbroken phones.


If you want,you can using the private-frameworks CoreTelephony which called "CTMessageCenter" class.There are a few methods to send sms.

+16  A: 

In App SMS is finally supported in iPhone OS 4

Sachin Palewar
What about the NDA? :-)
The feature was announced by Apple publicly - the NDA just covers the details of the SDK, not the feature itself.
Look at my answer to find a tutorial showing you how to use MFMessageComposeViewController.
Jus' Wondrin'
+8  A: 

For anyone searching for the SMS API, here is the documentation. Googling a little about the subject, I've found some forums (here and here) talking about CTMessageCenter (from CoreTelephony Framework) in OS 2 and 3, but not working in the new OS. I'm going to test both approaches and comment in this post.

Edit: It's important to note that using API's not released to developers by Apple may incur in your app being blocked, so use this link at your own risk.

Note: I've posted here since I'm note allowed to comment yet.

Alberto de Paola
+6  A: 

Here is a tutorial which does exactly what you are looking for: the MFMessageComposeViewController.

Jus' Wondrin'
+2  A: 

With ios in-app sms is supported. Here is the class def for that

+2  A: 

there is a class in iphone 4 which supports to send message with body and recipents from your application .it works the same as sending mail .you can found the documentation here link text

pankaj kainthla

My friends recommended me to try a third party program called Tansee iPhone Transfer SMS,which is a one-click solution when your iPhone text box is full and keeps rejecting receiving any texts.You can transfer the backup of all important iPhone SMS to computer as a txt file or a ANTS file.I have tried its trail version before,and it was downloadable and would keep you SMS in safe.