<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Messages",
  "identifier" : "/documentation/Messages/MSConversation/send(_:completionHandler:)-9krz",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Messages"
    ],
    "preciseIdentifier" : "c:objc(cs)MSConversation(im)sendMessage:completionHandler:"
  },
  "title" : "send(_:completionHandler:)"
}
-->

# send(_:completionHandler:)

Sends a message object.

```
func send(_ message: MSMessage, completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
```

## Parameters

`message`

The message object to send.

`completionHandler`

A block that’s called as soon as the message starts sending. This block is passed the following parameter:

- error: An error object. If an error occurred, this object contains information about the error; otherwise, it’s set to `nil`. The system validates the message before inserting it. Errors occur if the message is invalid or if the user hasn’t recently interacted with your app.

## Discussion

> Important:
> You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration:
> 
> ```swift
> func send(_ message: MSMessage) async throws
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/calling-objective-c-apis-asynchronously>.

This method starts sending the message object automatically,  without any additional user interactions. You can call this method only in response to a user action while in the [`MSMessagesAppPresentationContext.messages`](/documentation/Messages/MSMessagesAppPresentationContext/messages) context.

When calling this method, the following rules apply:

- If the app isn’t visible, the send fails with a [`MSMessageErrorCode.sendWhileNotVisible`](/documentation/Messages/MSMessageErrorCode/sendWhileNotVisible) error code.
- If the app hasn’t registered a recent touch interaction from the user, the send fails with a [`MSMessageErrorCode.sendWithoutRecentInteraction`](/documentation/Messages/MSMessageErrorCode/sendWithoutRecentInteraction) error code.
- If the app is in the [`MSMessagesAppPresentationContext.media`](/documentation/Messages/MSMessagesAppPresentationContext/media) context, the send fails with an [`MSMessageErrorCode.apiUnavailableInPresentationContext`](/documentation/Messages/MSMessageErrorCode/apiUnavailableInPresentationContext) error.

This method operates asynchronously. Although the method returns immediately, the actual work is deferred and performed in the background. As soon as the message starts to send, the system calls the completion block on a background queue.

Subsequent calls to this method replace any existing message in the input field.

If the message was initialized using the session from an existing message, a new message isn’t added to the transcript. Instead, the system takes the following steps as soon as the user sends the message:

1. The system moves the existing message to the bottom of the conversation transcript.
2. It updates the message with the new content.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)