/ SDKs / iOS
SDKs
Chat SDKs iOS v4
Chat SDKs iOS
Chat SDKs
iOS
Version 4

Clear the chat history in a group channel

Copy link

By using the resetMyHistory(completionHandler:) method, you can help the current user clear the chat history in a group channel and start a fresh conversation with other members in the same channel. As the method's name implies, the chat history will be cleared only from the channel view of the current user, and will no longer be shown in that view. But the messages aren't deleted from the database of the Sendbird system, and other members can still see all the messages in their channel views.

This method simply clears the messages for the user by updating the lastMessage and messageOffsetTimestamp properties of a group channel object in addition to other internally managed data such as the number of the user’s unread message.

channel.resetMyHistory { error in
    guard error == nil else {
        // Handle error.
        return
    }
}