IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMManager(Message)

Instance Methods

(void) - addAdvancedMsgListener:
 
(void) - removeAdvancedMsgListener:
 
(V2TIMMessage *) - createTextMessage:
 
(V2TIMMessage *) - createTextAtMessage:atUserList:
 
(V2TIMMessage *) - createCustomMessage:
 
(V2TIMMessage *) - createCustomMessage:desc:extension:
 
(V2TIMMessage *) - createImageMessage:
 
(V2TIMMessage *) - createSoundMessage:duration:
 
(V2TIMMessage *) - createVideoMessage:type:duration:snapshotPath:
 
(V2TIMMessage *) - createFileMessage:fileName:
 
(V2TIMMessage *) - createLocationMessage:longitude:latitude:
 
(V2TIMMessage *) - createFaceMessage:data:
 
(V2TIMMessage *) - createMergerMessage:title:abstractList:compatibleText:
 
(V2TIMMessage *) - createForwardMessage:
 
(NSString *) - sendMessage:receiver:groupID:priority:onlineUserOnly:offlinePushInfo:progress:succ:fail:
 
(void) - setC2CReceiveMessageOpt:opt:succ:fail:
 
(void) - getC2CReceiveMessageOpt:succ:fail:
 
(void) - setGroupReceiveMessageOpt:opt:succ:fail:
 
(void) - getC2CHistoryMessageList:count:lastMsg:succ:fail:
 
(void) - getGroupHistoryMessageList:count:lastMsg:succ:fail:
 
(void) - getHistoryMessageList:succ:fail:
 
(void) - revokeMessage:succ:fail:
 
(void) - markC2CMessageAsRead:succ:fail:
 
(void) - markGroupMessageAsRead:succ:fail:
 
(void) - markAllMessageAsRead:fail:
 
(void) - deleteMessageFromLocalStorage:succ:fail:
 
(void) - deleteMessages:succ:fail:
 
(void) - clearC2CHistoryMessage:succ:fail:
 
(void) - clearGroupHistoryMessage:succ:fail:
 
(NSString *) - insertGroupMessageToLocalStorage:to:sender:succ:fail:
 
(NSString *) - insertC2CMessageToLocalStorage:to:sender:succ:fail:
 
(void) - findMessages:succ:fail:
 
(void) - searchLocalMessages:succ:fail:
 

Protected Types

enum  V2TIMMessageStatus : NSInteger
 
enum  V2TIMElemType : NSInteger
 
enum  V2TIMOfflinePushFlag : NSInteger
 
enum  V2TIMImageType : NSInteger
 
enum  V2TIMGroupTipsType : NSInteger
 
enum  V2TIMGroupInfoChangeType : NSInteger
 
enum  V2TIMMessageGetType : NSInteger
 
enum  V2TIMReceiveMessageOpt : NSInteger
 
enum  V2TIMKeywordListMatchType : NSInteger
 
typedef void(^ V2TIMMessageListSucc) (NSArray< V2TIMMessage * > *msgs)
 
typedef void(^ V2TIMSearchMessageListSucc) (V2TIMMessageSearchResult *searchResult)
 
typedef void(^ V2TIMProgress) (uint32_t progress)
 
typedef void(^ V2TIMDownLoadProgress) (NSInteger curSize, NSInteger totalSize)
 
typedef void(^ V2TIMReceiveMessageOptListSucc) (NSArray< V2TIMReceiveMessageOptInfo * > *optList)
 

Protected Attributes

NSString *const kImSDK_MesssageAtALL
 

Member Typedef Documentation

◆ V2TIMMessageListSucc

- (typedef void(^ V2TIMMessageListSucc) (NSArray< V2TIMMessage * > *msgs))
protected

Callback definition on get history message list.

◆ V2TIMSearchMessageListSucc

- (typedef void(^ V2TIMSearchMessageListSucc) (V2TIMMessageSearchResult *searchResult))
protected

Callback definition on search history message.

◆ V2TIMProgress

- (typedef void(^ V2TIMProgress) (uint32_t progress))
protected

Callback definition for file upload progress.

◆ V2TIMDownLoadProgress

- (typedef void(^ V2TIMDownLoadProgress) (NSInteger curSize, NSInteger totalSize))
protected

Callback definition for file download progress.

◆ V2TIMReceiveMessageOptListSucc

- (typedef void(^ V2TIMReceiveMessageOptListSucc) (NSArray< V2TIMReceiveMessageOptInfo * > *optList))
protected

Callback definition for get message receive option.

Member Enumeration Documentation

◆ V2TIMMessageStatus

- (enum V2TIMMessageStatus) :
protected

Enumeration definition of message status.

Enumerator
V2TIM_MSG_STATUS_SENDING 

Message being sent.

V2TIM_MSG_STATUS_SEND_SUCC 

Message sent successfully.

V2TIM_MSG_STATUS_SEND_FAIL 

Message fails to be sent.

V2TIM_MSG_STATUS_HAS_DELETED 

Message deleted.

V2TIM_MSG_STATUS_LOCAL_IMPORTED 

Message imported to local storage.

V2TIM_MSG_STATUS_LOCAL_REVOKED 

Message revoked.

◆ V2TIMElemType

- (enum V2TIMElemType) :
protected

Enumeration definition of message element type.

Enumerator
V2TIM_ELEM_TYPE_NONE 

No element.

V2TIM_ELEM_TYPE_TEXT 

Text message.

V2TIM_ELEM_TYPE_CUSTOM 

Custom message.

V2TIM_ELEM_TYPE_IMAGE 

Image message.

V2TIM_ELEM_TYPE_SOUND 

Voice message.

V2TIM_ELEM_TYPE_VIDEO 

Video message.

V2TIM_ELEM_TYPE_FILE 

File message.

V2TIM_ELEM_TYPE_LOCATION 

Geographical location message.

V2TIM_ELEM_TYPE_FACE 

Emoji message.

V2TIM_ELEM_TYPE_GROUP_TIPS 

Group tip message.

V2TIM_ELEM_TYPE_MERGER 

Forward message.

◆ V2TIMOfflinePushFlag

- (enum V2TIMOfflinePushFlag) :
protected

Enumeration definition of offline push flag.

Enumerator
V2TIM_OFFLINE_PUSH_DEFAULT 

Push mesage when offline according to the default rules.

V2TIM_OFFLINE_PUSH_NO_PUSH 

Don't push mesage when offline.

◆ V2TIMImageType

- (enum V2TIMImageType) :
protected

Enumeration definition of image type.

Enumerator
V2TIM_IMAGE_TYPE_ORIGIN 

Original image.

V2TIM_IMAGE_TYPE_THUMB 

Thumbnail.

V2TIM_IMAGE_TYPE_LARGE 

Large image.

◆ V2TIMGroupTipsType

- (enum V2TIMGroupTipsType) :
protected

Enumeration definition of group tip type.

Enumerator
V2TIM_GROUP_TIPS_TYPE_JOIN 

Proactively join a group (memberList joins a group; valid only for non-Work groups)

V2TIM_GROUP_TIPS_TYPE_INVITE 

Be invited to a group (opMember invites memberList to join a group; valid only for Work groups)

V2TIM_GROUP_TIPS_TYPE_QUIT 

Quit a group.

V2TIM_GROUP_TIPS_TYPE_KICKED 

Be kicked out of a group (opMember kicks memberList out of the group)

V2TIM_GROUP_TIPS_TYPE_SET_ADMIN 

Set an admin (opMember sets memberList as an admin)

V2TIM_GROUP_TIPS_TYPE_CANCEL_ADMIN 

Cancel an admin (opMember cancels memberList as an admin)

V2TIM_GROUP_TIPS_TYPE_GROUP_INFO_CHANGE 

Group profile change (opMember modifies group information:groupName & introduction & notification & faceUrl & owner & custom)

V2TIM_GROUP_TIPS_TYPE_MEMBER_INFO_CHANGE 

Group member profile change (opMember modifies group member information:muteTime)

◆ V2TIMGroupInfoChangeType

- (enum V2TIMGroupInfoChangeType) :
protected

Enumeration definition of change type to group information.

Enumerator
V2TIM_GROUP_INFO_CHANGE_TYPE_NAME 

Change the group name.

V2TIM_GROUP_INFO_CHANGE_TYPE_INTRODUCTION 

Modify the group introduction.

V2TIM_GROUP_INFO_CHANGE_TYPE_NOTIFICATION 

Modify the group notice.

V2TIM_GROUP_INFO_CHANGE_TYPE_FACE 

Modify the group profile photo.

V2TIM_GROUP_INFO_CHANGE_TYPE_OWNER 

Change the group owner.

V2TIM_GROUP_INFO_CHANGE_TYPE_CUSTOM 

Change the custom group field.

V2TIM_GROUP_INFO_CHANGE_TYPE_SHUT_UP_ALL 

Change the group muting field.

◆ V2TIMMessageGetType

- (enum V2TIMMessageGetType) :
protected

Enumeration definition of message pull type.

Enumerator
V2TIM_GET_CLOUD_OLDER_MSG 

Get older messages from the cloud.

V2TIM_GET_CLOUD_NEWER_MSG 

Get newer messages from the cloud.

V2TIM_GET_LOCAL_OLDER_MSG 

Get older messages from local storage.

V2TIM_GET_LOCAL_NEWER_MSG 

Get newer messages from local storage.

◆ V2TIMReceiveMessageOpt

- (enum V2TIMReceiveMessageOpt) :
protected

Enumeration definition of message receive option.

Enumerator
V2TIM_RECEIVE_MESSAGE 

Messages will be received when the user is online, and offline push notifications will be received when the user is offline.

V2TIM_NOT_RECEIVE_MESSAGE 

No message will be received.

V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE 

Messages will be received when the user is online, and no push notification will be received when the user is offline.

◆ V2TIMKeywordListMatchType

- (enum V2TIMKeywordListMatchType) :
protected

Enumeration definition of keyword list matching type when search message.

Enumerator
V2TIM_KEYWORD_LIST_MATCH_TYPE_OR 
V2TIM_KEYWORD_LIST_MATCH_TYPE_AND 

Method Documentation

◆ addAdvancedMsgListener:()

- (void) addAdvancedMsgListener: (addAdvancedMsgListener(listener:))  NS_SWIFT_NAME

1.1 Add an event listener for advanced messages

◆ removeAdvancedMsgListener:()

- (void) removeAdvancedMsgListener: (removeAdvancedMsgListener(listener:))  NS_SWIFT_NAME

1.2 Remove the event listener for advanced messages

◆ createTextMessage:()

- (V2TIMMessage *) createTextMessage: (NSString *)  text

2.1 Create a text message

◆ createTextAtMessage:atUserList:()

- (V2TIMMessage *) createTextAtMessage: (NSString *)  text
atUserList: (NSMutableArray< NSString * > *)  atUserList 

2.2 Create a text message with the @ notification feature

Notification messages are only applicable to messages sent in the group.

Parameters
atUserListList of @ target users. To @all, please pass in the kImSDK_MesssageAtALL constant string. For example, if you want the current text message to @denny, @lucy, and @all, pass in ["denny","lucy",kImSDK_MesssageAtALL] for atUserList.
Attention
The following are use limits for atUserList:
  • The maximum number of @ target users is 30 by default. If this limit is exceeded, message sending will fail.
  • The total number of users specified by atUserList cannot exceed the default maximum number, including the case of @all.

◆ createCustomMessage:()

- (V2TIMMessage *) createCustomMessage: (NSData *)  data

2.3 Create a custom message

◆ createCustomMessage:desc:extension:()

- (V2TIMMessage *) createCustomMessage: (NSData *)  data
desc: (NSString *)  desc
extension: (NSString *)  extension 

2.4 Create a custom message and set offline push information

Parameters
descCustom message description information to be displayed in text during offline push
extensionExtension field information during offline push

◆ createImageMessage:()

- (V2TIMMessage *) createImageMessage: (NSString *)  imagePath

2.5 Create an image message (image size limit: 28 MB)

◆ createSoundMessage:duration:()

- (V2TIMMessage *) createSoundMessage: (NSString *)  audioFilePath
duration: (int)  duration 

2.6 Create a voice message (voice size limit: 28 MB)

Parameters
durationVoice duration, in seconds

◆ createVideoMessage:type:duration:snapshotPath:()

- (V2TIMMessage *) createVideoMessage: (NSString *)  videoFilePath
type: (NSString *)  type
duration: (int)  duration
snapshotPath: (NSString *)  snapshotPath 

2.7 Create a video message (video size limit: 100 MB)

Parameters
typeVideo type, such as mp4 and mov
durationVideo duration, in seconds
snapshotPathVideo cover image path

◆ createFileMessage:fileName:()

- (V2TIMMessage *) createFileMessage: (NSString *)  filePath
fileName: (NSString *)  fileName 

2.8 Create a file message (file size limit: 100 MB)

◆ createLocationMessage:longitude:latitude:()

- (V2TIMMessage *) createLocationMessage: (NSString *)  desc
longitude: (double)  longitude
latitude: (double)  latitude 

2.9 Create a location message

◆ createFaceMessage:data:()

- (V2TIMMessage *) createFaceMessage: (int)  index
data: (NSData *)  data 

2.10 Create an emoji message

The IM SDK does not provide an emoji package. Developers can use index to store the indexes of the emojis they have in their emoji packages. Alternatively, they can directly use data to store emoji binary data and the string key. Either way, developers can customize emojis. The IM SDK is only responsible for passing them through.

Parameters
indexEmoji index
dataCustom data

◆ createMergerMessage:title:abstractList:compatibleText:()

- (V2TIMMessage *) createMergerMessage: (NSArray< V2TIMMessage * > *)  messageList
title: (NSString *)  title
abstractList: (NSArray< NSString * > *)  abstractList
compatibleText: (NSString *)  compatibleText 

2.11 Create a combined message (supported only in 5.2.210 and later versions)

Usually when we receive a combined message, the chat screen will look like this:

|Chat History of Vinson and Lynx | – title (Title)

|Vinson: When is the new version of SDK scheduled to go online? | – abstract1 (Digest information 1)

|Lynx: Next Monday. The specific time depends on the system test result in these two days. | – abstract2 (Digest information 2)

|Vinson: OK | – abstract3 (Digest information 3)

The chat UI usually displays only the title and digest information of the combined message, and the complete combined message list will be displayed only when the user clicks the combined message on the UI.

You can create a combined message (V2TIMMessage) for multiple messages to be forwarded and call the sendMessage API to send the combined message. The procedure is as follows:

1. Call createMergerMessage to create a combined message V2TIMMessage.

2. Call sendMessage to send the forward message V2TIMMessage.

The procedure for parsing a combined message received is as follows:

1. Obtain mergerElem via V2TIMMessage.

2. Obtain title and abstractList via mergerElem for UI display.

3. When a user clicks the digest information on the UI, call downloadMessageList to get the list of forwarded messages.

Parameters
messageListMessage list (Up to 300 messages are supported. The message object must be in the V2TIM_MSG_STATUS_SEND_SUCC status. The message type cannot be V2TIMGroupTipsElem.)
titleSource of the combined message, for example, "Chat History of Vinson and Lynx" and "xxx group chat history"
abstractListCombined message digest list (supports up to 5 digests, each containing a maximum of 100 characters) You can set digest information in different formats for different message types, for example: For a text message, the digest can be in the "sender:text" format. For an image message, the digest can be in the "sender:[image]" format. For a file message, the digest can be in the "sender:[file]" format.
compatibleTextCombined messages are compatible with text. SDKs of early versions do not support combined messages, and they will send a text message with the content compatibleText by default. The parameter cannot be null.

◆ createForwardMessage:()

- (V2TIMMessage *) createForwardMessage: (V2TIMMessage *)  message

2.12 Create a forward message (supported only in 5.2.210 and later versions)

If you need to forward a message, you cannot directly call the sendMessage API to send the original message. Instead, you need to call createForwardMessage to create a forward message first and send it.

Parameters
messageMessage object to be forwarded. The message status must be V2TIM_MSG_STATUS_SEND_SUCC. The message type cannot be V2TIMGroupTipsElem.
Returns
Forward message object. The elem content is the same as the original message.

◆ sendMessage:receiver:groupID:priority:onlineUserOnly:offlinePushInfo:progress:succ:fail:()

- (NSString *) sendMessage: (V2TIMMessage *)  message
receiver: (NSString *)  receiver
groupID: (NSString *)  groupID
priority: (V2TIMMessagePriority)  priority
onlineUserOnly: (BOOL)  onlineUserOnly
offlinePushInfo: (V2TIMOfflinePushInfo *)  offlinePushInfo
progress: (V2TIMProgress progress
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

3.1 Send an advanced message (advanced version: provides the features of specifying message priorities and push information)

Parameters
messageMessage object to be sent, which needs to be created via the corresponding message creation API
receiverMessage recipient's userID. For a one-to-one message, you only need to specify this field.
groupIDTarget group ID For a group chat message, you only need to specify this field.
priorityMessage priorities. This field is valid only for group chat messages. You are advised to set higher priorities for important messages (such as red packet and gift messages) and set lower priorities for frequent but unimportant messages (such as like messages).
onlineUserOnlyWhether the message can be received only by online users. If this field is set to true, the message cannot be pulled in recipient historical message pulling. This field is often used to implement weak notification features such as "The other party is typing" or unimportant notifications in the group. This field is not supported by audio-video groups (AVChatRoom).
offlinePushInfoTitle and voice carried when the message pushing offline.
Returns
msgID Unique ID of the message
Attention
  • Before setting the offlinePushInfo field, you need to enable push via V2TIMOfflinePushManager. After push is enabled, all messages except custom messages will be pushed by default.
  • If you want to push custom messages as well, set the desc field in offlinePushInfo so that the information specified by desc will be displayed by default during push.
  • Audio-video groups (AVChatRoom) do not support the onlineUserOnly field. You need to set onlineUserOnly to false for audio-video groups (AVChatRoom).
  • If onlineUserOnly is set to true, the message is an online message and is not counted as an unread message.

◆ setC2CReceiveMessageOpt:opt:succ:fail:()

- (void) setC2CReceiveMessageOpt: (NSArray< NSString * > *)  userIDList
opt: (V2TIMReceiveMessageOpt opt
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

4.1 Set the one-to-one message receiving option for specified users (batch setting supported)

Supported only in 5.3.425 and later versions.

Attention
Notes:
  • This API supports batch setting. You can use the userIDList field to specify up to 30 users for batch setting.
  • This API can be called for up to 5 times per second.
Parameters
optThere are three message receiving options: V2TIMMessage.V2TIM_RECEIVE_MESSAGE: messages will be received when the user is online, and push notifications will be received when the user is offline. V2TIMMessage.V2TIM_NOT_RECEIVE_MESSAGE: no message will be received. V2TIMMessage.V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE: messages will be received when the user is online, and no push notification will be received when the user is offline.

◆ getC2CReceiveMessageOpt:succ:fail:()

- (void) getC2CReceiveMessageOpt: (NSArray< NSString * > *)  userIDList
succ: (V2TIMReceiveMessageOptListSucc succ
fail: (V2TIMFail)  fail 

4.2 Query the one-to-one message receiving option for specified users

Supported only in 5.3.425 and later versions.

◆ setGroupReceiveMessageOpt:opt:succ:fail:()

- (void) setGroupReceiveMessageOpt: (NSString *)  groupID
opt: (V2TIMReceiveMessageOpt opt
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

4.3 Set the group message receiving option

◆ getC2CHistoryMessageList:count:lastMsg:succ:fail:()

- (void) getC2CHistoryMessageList: (NSString *)  userID
count: (int)  count
lastMsg: (V2TIMMessage *)  lastMsg
succ: (V2TIMMessageListSucc succ
fail: (V2TIMFail)  fail 

5.1 Get historical one-to-one messages

Parameters
countNumber of messages pulled at a time. The value of this field cannot be too large; otherwise, the pulling speed is affected. We recommend that you pull 20 messages at a time.
lastMsgStart message for message pulling. If null is passed in, the newest message of the conversation will be considered as the start message.
Attention
If the IM SDK detects that the network connection is unavailable, it directly returns local data.

◆ getGroupHistoryMessageList:count:lastMsg:succ:fail:()

- (void) getGroupHistoryMessageList: (NSString *)  groupID
count: (int)  count
lastMsg: (V2TIMMessage *)  lastMsg
succ: (V2TIMMessageListSucc succ
fail: (V2TIMFail)  fail 

5.2 Get historical group messages

Parameters
countNumber of messages pulled at a time. The value of this field cannot be too large; otherwise, the pulling speed is affected. We recommend that you pull 20 messages at a time.
lastMsgStart message for message pulling. If null is passed in, the newest message of the conversation will be considered as the start message.
Attention
Notes:
  • If the IM SDK detects that the network connection is unavailable, it directly returns local data.
  • Only meeting groups (Meeting) support pulling historical messages of members before they join the groups. For audio-video groups (AVChatRoom), messages are not saved to the roaming and local databases, and therefore this API does not take effect.

◆ getHistoryMessageList:succ:fail:()

- (void) getHistoryMessageList: (V2TIMMessageListGetOption *)  option
succ: (V2TIMMessageListSucc succ
fail: (V2TIMFail)  fail 

5.3 Get historical messages (advanced API)

Parameters
optionMessage pulling option, which can be set to pull older or newer messages from local storage or the cloud
Attention
Notes:
  • If option is set to pull messages from the cloud, and the IM SDK detects that the network connection is unavailable, the IM SDK directly returns local data.
  • Only meeting groups (Meeting) support pulling historical messages of members before they join the groups. For audio-video groups (AVChatRoom), messages are not saved to the roaming and local databases, and therefore this API does not take effect.

◆ revokeMessage:succ:fail:()

- (void) revokeMessage: (V2TIMMessage *)  msg
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

5.4 Recall messages

Attention
Notes:
  • By default, you can recall only messages that are sent within 2 minutes. You can customize the time limit for message recall via the console (Feature Configuration -> Login and Message -> Message Recall Settings).
  • Only common messages sent in one-to-one chats and group chats can be recalled. Messages that can be received only by online users (onlineUserOnly is set to true) and audio-video group (AVChatRoom) messages cannot be recalled.
  • If the sender recalls a message, the recipient will receive the V2TIMAdvancedMsgListener -> onRecvMessageRevoked callback.

◆ markC2CMessageAsRead:succ:fail:()

- (void) markC2CMessageAsRead: (NSString *)  userID
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

5.5 Mark one-to-one messages as read

Attention
If the userID is nil, all one-to-one messages wil be marked as read. More importantly, it only supported in 5.8 and later versions.

◆ markGroupMessageAsRead:succ:fail:()

- (void) markGroupMessageAsRead: (NSString *)  groupID
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

5.6 Mark group messages as read

Attention
If the groupID is nil, all group messages wil be marked as read. More importantly, it only supported in 5.8 and later versions.

◆ markAllMessageAsRead:fail:()

- (void) markAllMessageAsRead: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

5.7 Mark all messages as read(Supported only in 5.8 and later versions)

◆ deleteMessageFromLocalStorage:succ:fail:()

- (void) deleteMessageFromLocalStorage: (V2TIMMessage *)  msg
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

5.8 Delete a message from local storage

Attention
Messages can only be deleted locally. After a message is deleted, the SDK marks the message as deleted locally, and the message can no longer be pulled via getHistoryMessage. However, after the app is uninstalled and reinstalled, the local delete marker of the message will get lost, and the message can still be pulled via getHistoryMessage.

◆ deleteMessages:succ:fail:()

- (void) deleteMessages: (NSArray< V2TIMMessage * > *)  msgList
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

5.9 Delete messages from local storage and the cloud

Attention
In addition to deleting messages from the local storage (deleteMessageFromLocalStorage), this API simultaneously deletes messages from the cloud, and the deleted messages cannot be recovered. Please note that:
  • Up to 30 messages can be deleted at a time.
  • The messages to be deleted at a time must belong to the same conversation.
  • This API can be called only once per second.
  • If the account has pulled these messages from other devices, the messages will still be stored on those devices after this API is called to delete them. That is, the operation of message deletion cannot be synchronized across multiple devices.

◆ clearC2CHistoryMessage:succ:fail:()

- (void) clearC2CHistoryMessage: (NSString *)  userID
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

5.10 Clear chat history with a user from local storage and the cloud (without deleting the conversation)

Supported only in 5.4.666 and later versions.

Attention
Notes:
  • When messages in a conversation are deleted from local storage, they are deleted simultaneously from the server.

◆ clearGroupHistoryMessage:succ:fail:()

- (void) clearGroupHistoryMessage: (NSString *)  groupID
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

5.11 Clear chat history of a group from local storage and the cloud (without deleting the conversation)

Supported only in 5.4.666 and later versions.

Attention
Notes:
  • When messages in a conversation are deleted from local storage, they are also deleted from the server.

◆ insertGroupMessageToLocalStorage:to:sender:succ:fail:()

- (NSString *) insertGroupMessageToLocalStorage: (V2TIMMessage *)  msg
to: (NSString *)  groupID
sender: (NSString *)  sender
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

5.12 Add a message to the group message list

This API is mainly used to meet the requirement of inserting informative messages, such as "you have exited the group", into a group chat conversation. Such messages need to be displayed in the chat interface but do not need to be sent to others. Messages that need to be displayed in the chat interface but do not need to be sent to others. Therefore, insertGroupMessageToLocalStorage() is equivalent to a sendMessage() API whose network sending capability is disabled.

Returns
msgID Unique ID of a message
Attention
Messages saved via this API are saved only to the local storage and will get lost after the app is uninstalled.

◆ insertC2CMessageToLocalStorage:to:sender:succ:fail:()

- (NSString *) insertC2CMessageToLocalStorage: (V2TIMMessage *)  msg
to: (NSString *)  userID
sender: (NSString *)  sender
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

5.13 Insert a message in a one-to-one chat

This API is mainly used to meet the requirement of inserting informative messages, such as "you have exited the group", into a one-to-one chat conversation. Such messages need to be displayed in the chat interface but do not need to be sent to the peer party. Messages that need to be displayed in the chat interface but do not need to be sent to others. Therefore, insertC2CMessageToLocalStorage() is equivalent to a sendMessage() API whose network sending capability is disabled.

Returns
msgID Unique ID of a message
Attention
Messages saved via this API are saved only to the local storage and will get lost after the app is uninstalled.

◆ findMessages:succ:fail:()

- (void) findMessages: (NSArray< NSString * > *)  messageIDList
succ: (V2TIMMessageListSucc succ
fail: (V2TIMFail)  fail 

5.14 Query local messages in a specified conversation by messageID

Parameters
messageIDListMessage ID list

◆ searchLocalMessages:succ:fail:()

- (void) searchLocalMessages: (V2TIMMessageSearchParam *)  param
succ: (V2TIMSearchMessageListSucc succ
fail: (V2TIMFail)  fail 

5.15 Search for local messages (supported only in 5.4.666 and later versions and need to buy Flagship Edition)

Parameters
searchParamMessage search parameter. For details, see the definition of V2TIMMessageSearchParam.

Field Documentation

◆ kImSDK_MesssageAtALL

- (NSString* const) kImSDK_MesssageAtALL
protected

A constant string indicateds @all when filled in createTextAtMessage API.