Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information. reorganizing files into recipes folder Mar 7, 2018

id title brief sdk
Send an SMS or iMessage
This recipe shows how to send an SMS or iMessage.


To send an SMS using the UIApplication.SharedApplication.OpenUrl method, follow these steps.

  • Create an NSUrl containing the telephone number to send the SMS to:
var smsTo = NSUrl.FromString("sms:18015551234");
  • Call OpenUrl with the NSUrl:

The Messages application will detect if the number you requested has iMessage enabled and will automatically switch to iMessage if possible. To trigger an iMessage to an Apple ID, replace the telephone number with the Apple ID:

var imessageTo = NSUrl.FromString("");

Additional Information

The OpenUrl method returns a bool which is false if there is no application to handle the request. You can detect whether an application is present using the CanOpenUrl method like this:

var smsTo = NSUrl.FromString("sms:18015551234");
if (UIApplication.SharedApplication.CanOpenUrl(smsTo)) {
} else {
    // warn the user, or hide the button...

You cannot specify the text that is placed in the message, nor can you force a message to be sent via code. Only the user can type and send the message.