SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site,, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Error handling in Twilio Conversations iOS SDK with code example

The Twilio Conversations SDK for iOS allows users to collect debugging logs for any errors they may be seeing. This guide provides helpful diagnostics tips and code samples for capturing logs of any issues you run into.


Most operations that can be performed on objects in Conversations for iOS return a TCHResult object to their completion block. This includes operations against Conversations, Messages, and Participants.

This object contains an isSuccessful method, as well as an error property, which will be populated with an error, should the operation fail. Your application should check for this error and never disregard it.

For more details, see our iOS Error Handling - Objective-C, Swift documentation.

conversation.SomeEvent(message) { tchResult in
if let error = tchResult.error {


For issues where the client could not be initialised, the token update failed, or notification registration failed, errorReceived can be used.

func conversationsClient(_ client: TwilioConversationsClient, errorReceived error: TCHError)..

This method will be called during client creation if any errors occur. If client initialization fails, and a nil client is returned, this method will be called with an explanation of why the creation failed.

Connection events:

The connectionStateUpdated events are emitted for various connection states through the ConversationsClientDelegate. The connection states are a constant.

Here are the possible values:

connecting client is offline and a connection attempt is in process
connected client is online and ready
disconnecting client is going offline and a disconnection is in process
disconnected client is offline and no connection attempt is in process
denied client connection is denied because of invalid JWT access token. User must refresh token in order to proceed

Notice: The disconnecting state indicates a graceful disconnect, and that the SDK already knows that this is going to happen. However, it can also be caused by errors, such as the client being not able to establish connection with the server for various reasons.

Have more questions? Submit a request
Powered by Zendesk