HyphenateSDK  3.6.1
构造函数 | 所有成员列表
<IEMChatManager>协议 参考

#import <IEMChatManager.h>

类 <IEMChatManager> 继承关系图:

构造函数

(void) - addDelegate:delegateQueue:
 
(void) - removeDelegate:
 
(NSArray *) - getAllConversations
 
(EMConversation *) - getConversation:type:createIfNotExist:
 
(void) - deleteConversation:isDeleteMessages:completion:
 
(void) - deleteConversations:isDeleteMessages:completion:
 
(void) - importConversations:completion:
 
(NSString *) - getMessageAttachmentPath:
 
(void) - importMessages:completion:
 
(void) - updateMessage:completion:
 
(void) - sendMessageReadAck:completion:
 
(void) - recallMessage:completion:
 
(void) - sendMessage:progress:completion:
 
(void) - resendMessage:progress:completion:
 
(void) - downloadMessageThumbnail:progress:completion:
 
(void) - downloadMessageAttachment:progress:completion:
 
(EMCursorResult *) - fetchHistoryMessagesFromServer:conversationType:startMessageId:pageSize:error:
 
(void) - asyncFetchHistoryMessagesFromServer:conversationType:startMessageId:pageSize:completion:
 
(void) - addDelegate:
 
("Use -getAllConversations") - __deprecated_msg
 
(BOOL) - deleteConversation:deleteMessages:
 
(BOOL) - deleteConversations:deleteMessages:
 
(BOOL) - importConversations:
 
(BOOL) - importMessages:
 
(BOOL) - updateMessage:
 
(void) - asyncSendReadAckForMessage:
 
(void) - asyncSendMessage:progress:completion:
 
(void) - asyncResendMessage:progress:completion:
 
(void) - asyncDownloadMessageThumbnail:progress:completion:
 
(void) - asyncDownloadMessageAttachments:progress:completion:
 
(void) - loadMessagesWithType:timestamp:count:fromUser:searchDirection:completion:
 
(void) - loadMessagesWithKeyword:timestamp:count:fromUser:searchDirection:completion:
 

详细描述

聊天相关操作 目前消息都是从DB中加载,沒有從server端加载

函数文档

- ("Use -getAllConversations") __deprecated_msg
required

从数据库中获取所有的会话,执行后会更新内存中的会话列表

同步方法,会阻塞当前线程

返回
会话列表<EMConversation>
- (void) addDelegate: (3_1_0) 
(3_2_2) 
("Use -")  EM_DEPRECATED_IOS[IEMChatManager addDelegate:delegateQueue:] 
required

添加回调代理

参数
aDelegate要添加的代理
- (void) addDelegate: (id< EMChatManagerDelegate >)  aDelegate
delegateQueue: (dispatch_queue_t)  aQueue 
required

添加回调代理

参数
aDelegate要添加的代理
aQueue执行代理方法的队列
- (void) asyncDownloadMessageAttachments: (EMMessage *)  aMessage
progress: (void(^)(int progress))  aProgressCompletion
completion: ("Use -downloadMessageAttachment:progress:completion")  __deprecated_msg 
required

下载消息附件(语音,视频,图片原图,文件),SDK会自动下载语音消息,所以除非自动下载语音失败,用户不需要自动下载语音附件

异步方法

参数
aMessage消息
aProgressCompletion附件下载进度回调block
aCompletion下载完成回调block
- (void) asyncDownloadMessageThumbnail: (EMMessage *)  aMessage
progress: (void(^)(int progress))  aProgressCompletion
completion: ("Use -downloadMessageThumbnail:progress:completion:")  __deprecated_msg 
required

下载缩略图(图片消息的缩略图或视频消息的第一帧图片),SDK会自动下载缩略图,所以除非自动下载失败,用户不需要自己下载缩略图

异步方法

参数
aMessage消息
aProgressCompletion附件下载进度回调block
aCompletion下载完成回调block
- (void) asyncFetchHistoryMessagesFromServer: (NSString *)  aConversationId
conversationType: (EMConversationType)  aConversationType
startMessageId: (NSString *)  aStartMessageId
pageSize: (int)  aPageSize
completion: (void(^)(EMCursorResult *aResult, EMError *aError))  aCompletionBlock 
required

从服务器获取指定会话的历史消息

异步方法

参数
aConversationId要获取漫游消息的Conversation id
aConversationType要获取漫游消息的Conversation type
aStartMessageId参考起始消息的ID
aPageSize获取消息条数
aCompletionBlock获取消息结束的callback
- (void) asyncResendMessage: (EMMessage *)  aMessage
progress: (void(^)(int progress))  aProgressCompletion
completion: ("Use -resendMessage:progress:completion:")  __deprecated_msg 
required

重发送消息

异步方法

参数
aMessage消息
aProgressCompletion附件上传进度回调block
aCompletion发送完成回调block
- (void) asyncSendMessage: (EMMessage *)  aMessage
progress: (void(^)(int progress))  aProgressCompletion
completion: ("Use -sendMessage:progress:completion:")  __deprecated_msg 
required

发送消息

异步方法

参数
aMessage消息
aProgressCompletion附件上传进度回调block
aCompletion发送完成回调block
- (void) asyncSendReadAckForMessage: ("Use -sendMessageReadAck:completion:")  __deprecated_msg
required

发送消息已读回执

异步方法

参数
aMessage消息
- (BOOL) deleteConversation: (NSString *)  aConversationId
deleteMessages: ("Use -deleteConversation:isDeleteMessages:completion:")  __deprecated_msg 
required

删除会话

参数
aConversationId会话ID
aDeleteMessage是否删除会话中的消息
返回
是否成功
- (void) deleteConversation: (NSString *)  aConversationId
isDeleteMessages: (BOOL)  aIsDeleteMessages
completion: (void(^)(NSString *aConversationId, EMError *aError))  aCompletionBlock 
required

删除会话

参数
aConversationId会话ID
aIsDeleteMessages是否删除会话中的消息
aCompletionBlock完成的回调
- (BOOL) deleteConversations: (NSArray *)  aConversations
deleteMessages: ("Use -deleteConversations:isDeleteMessages:completion:")  __deprecated_msg 
required

删除一组会话

参数
aConversations会话列表<EMConversation>
aDeleteMessage是否删除会话中的消息
返回
是否成功
- (void) deleteConversations: (NSArray *)  aConversations
isDeleteMessages: (BOOL)  aIsDeleteMessages
completion: (void(^)(EMError *aError))  aCompletionBlock 
required

删除一组会话

参数
aConversations会话列表<EMConversation>
aIsDeleteMessages是否删除会话中的消息
aCompletionBlock完成的回调
- (void) downloadMessageAttachment: (EMMessage *)  aMessage
progress: (void(^)(int progress))  aProgressBlock
completion: (void(^)(EMMessage *message, EMError *error))  aCompletionBlock 
required

下载消息附件(语音,视频,图片原图,文件),SDK会自动下载语音消息,所以除非自动下载语音失败,用户不需要自动下载语音附件

异步方法

参数
aMessage消息
aProgressBlock附件下载进度回调block
aCompletionBlock下载完成回调block
- (void) downloadMessageThumbnail: (EMMessage *)  aMessage
progress: (void(^)(int progress))  aProgressBlock
completion: (void(^)(EMMessage *message, EMError *error))  aCompletionBlock 
required

下载缩略图(图片消息的缩略图或视频消息的第一帧图片),SDK会自动下载缩略图,所以除非自动下载失败,用户不需要自己下载缩略图

参数
aMessage消息
aProgressBlock附件下载进度回调block
aCompletionBlock下载完成回调block
- (EMCursorResult *) fetchHistoryMessagesFromServer: (NSString *)  aConversationId
conversationType: (EMConversationType)  aConversationType
startMessageId: (NSString *)  aStartMessageId
pageSize: (int)  aPageSize
error: (EMError **)  pError 
required

从服务器获取指定会话的历史消息

参数
aConversationId要获取漫游消息的Conversation id
aConversationType要获取漫游消息的Conversation type
aStartMessageId参考起始消息的ID
aPageSize获取消息条数
pError错误信息
返回
获取的消息结果
- (NSArray *) getAllConversations
required

获取所有会话,如果内存中不存在会从DB中加载

返回
会话列表<EMConversation>
- (EMConversation *) getConversation: (NSString *)  aConversationId
type: (EMConversationType)  aType
createIfNotExist: (BOOL)  aIfCreate 
required

获取一个会话

参数
aConversationId会话ID
aType会话类型
aIfCreate如果不存在是否创建
返回
会话对象
- (NSString *) getMessageAttachmentPath: (NSString *)  aConversationId
required

获取消息附件路径,存在这个路径的文件,删除会话时会被删除

参数
aConversationId会话ID
返回
附件路径
- (BOOL) importConversations: ("Use -importConversations:completion:")  __deprecated_msg
required

导入一组会话到DB

参数
aConversations会话列表<EMConversation>
返回
是否成功
- (void) importConversations: (NSArray *)  aConversations
completion: (void(^)(EMError *aError))  aCompletionBlock 
required

导入一组会话到DB

参数
aConversations会话列表<EMConversation>
aCompletionBlock完成的回调
- (BOOL) importMessages: ("Use -importMessages:completion:")  __deprecated_msg
required

导入一组消息到DB

参数
aMessages消息列表<EMMessage>
返回
是否成功
- (void) importMessages: (NSArray *)  aMessages
completion: (void(^)(EMError *aError))  aCompletionBlock 
required

导入一组消息到DB

参数
aMessages消息列表<EMMessage>
aCompletionBlock完成的回调
- (void) loadMessagesWithKeyword: (NSString *)  aKeywords
timestamp: (long long)  aTimestamp
count: (int)  aCount
fromUser: (NSString *)  aSender
searchDirection: (EMMessageSearchDirection)  aDirection
completion: (void(^)(NSArray *aMessages, EMError *aError))  aCompletionBlock 
required

从数据库获取包含指定内容的消息,取到的消息按时间排序,如果参考的时间戳为负数,则从最新消息向前取,如果aCount小于等于0当作1处理

参数
aKeywords搜索关键字,如果为空则忽略
aTimestamp参考时间戳
aCount获取的条数
aSender消息发送方,如果为空则忽略
aDirection消息搜索方向
aCompletionBlock完成的回调
- (void) loadMessagesWithType: (EMMessageBodyType)  aType
timestamp: (long long)  aTimestamp
count: (int)  aCount
fromUser: (NSString *)  aUsername
searchDirection: (EMMessageSearchDirection)  aDirection
completion: (void(^)(NSArray *aMessages, EMError *aError))  aCompletionBlock 
required

从数据库获取指定类型的消息,取到的消息按时间排序,如果参考的时间戳为负数,则从最新消息取,如果aCount小于等于0当作1处理

参数
aType消息类型
aTimestamp参考时间戳
aCount获取的条数
aUsername消息发送方,如果为空则忽略
aDirection消息搜索方向
aCompletionBlock完成的回调
- (void) recallMessage: (EMMessage *)  aMessage
completion: (void(^)(EMMessage *aMessage, EMError *aError))  aCompletionBlock 
required

撤回消息

异步方法

参数
aMessage消息
aCompletionBlock完成的回调
- (void) removeDelegate: (id< EMChatManagerDelegate >)  aDelegate
required

移除回调代理

参数
aDelegate要移除的代理
- (void) resendMessage: (EMMessage *)  aMessage
progress: (void(^)(int progress))  aProgressBlock
completion: (void(^)(EMMessage *message, EMError *error))  aCompletionBlock 
required

重发送消息

参数
aMessage消息
aProgressBlock附件上传进度回调block
aCompletionBlock发送完成回调block
- (void) sendMessage: (EMMessage *)  aMessage
progress: (void(^)(int progress))  aProgressBlock
completion: (void(^)(EMMessage *message, EMError *error))  aCompletionBlock 
required

发送消息

参数
aMessage消息
aProgressBlock附件上传进度回调block
aCompletionBlock发送完成回调block
- (void) sendMessageReadAck: (EMMessage *)  aMessage
completion: (void(^)(EMMessage *aMessage, EMError *aError))  aCompletionBlock 
required

发送消息已读回执

异步方法

参数
aMessage消息
aCompletionBlock完成的回调
- (BOOL) updateMessage: ("Use -updateMessage:completion:")  __deprecated_msg
required

更新消息到DB

参数
aMessage消息
返回
是否成功
- (void) updateMessage: (EMMessage *)  aMessage
completion: (void(^)(EMMessage *aMessage, EMError *aError))  aCompletionBlock 
required

更新消息到DB

参数
aMessage消息
aCompletionBlock完成的回调

该协议的文档由以下文件生成: