AVIMConversation Class Reference

Inherits from NSObject
Declared in AVIMConversation.h

Other Methods

  clientId

The ID of the client which the conversation belongs to.

@property (nonatomic, strong, readonly, nullable) NSString *clientId

Discussion

The ID of the client which the conversation belongs to.

Declared In

AVIMConversation.h

  conversationId

The ID of the conversation.

@property (nonatomic, strong, readonly, nullable) NSString *conversationId

Discussion

The ID of the conversation.

Declared In

AVIMConversation.h

  creator

The clientId of the conversation creator.

@property (nonatomic, strong, readonly, nullable) NSString *creator

Discussion

The clientId of the conversation creator.

Declared In

AVIMConversation.h

  createAt

The creation time of the conversation.

@property (nonatomic, strong, readonly, nullable) NSDate *createAt

Discussion

The creation time of the conversation.

Declared In

AVIMConversation.h

  updateAt

The last updating time of the conversation. When fields like name, members changes, this time will changes.

@property (nonatomic, strong, readonly, nullable) NSDate *updateAt

Discussion

The last updating time of the conversation. When fields like name, members changes, this time will changes.

Declared In

AVIMConversation.h

  lastMessage

The last message in this conversation. @attention Getter method may query lastMessage from SQL, this may take a long time, be careful to use getter method in main thread.

@property (nonatomic, strong, readonly, nullable) AVIMMessage *lastMessage

Discussion

The last message in this conversation. @attention Getter method may query lastMessage from SQL, this may take a long time, be careful to use getter method in main thread.

Declared In

AVIMConversation.h

  lastMessageAt

The send timestamp of the last message in this conversation.

@property (nonatomic, strong, readonly, nullable) NSDate *lastMessageAt

Discussion

The send timestamp of the last message in this conversation.

Declared In

AVIMConversation.h

  lastReadAt

The last timestamp your message read by other.

@property (nonatomic, strong, readonly, nullable) NSDate *lastReadAt

Discussion

The last timestamp your message read by other.

Declared In

AVIMConversation.h

  lastDeliveredAt

The last timestamp your message delivered to other.

@property (nonatomic, strong, readonly, nullable) NSDate *lastDeliveredAt

Discussion

The last timestamp your message delivered to other.

Declared In

AVIMConversation.h

  unreadMessagesCount

The count of unread messages in current conversation.

@property (nonatomic, assign, readonly) NSUInteger unreadMessagesCount

Discussion

The count of unread messages in current conversation.

Declared In

AVIMConversation.h

  unreadMessagesMentioned

A flag indicates whether an unread message mentioned you.

@property (nonatomic, assign) BOOL unreadMessagesMentioned

Discussion

A flag indicates whether an unread message mentioned you.

Declared In

AVIMConversation.h

  name

The name of this conversation. Can be changed by update:callback: .

@property (nonatomic, strong, readonly, nullable) NSString *name

Discussion

The name of this conversation. Can be changed by update:callback: .

Declared In

AVIMConversation.h

  members

The ids of the clients who join the conversation. Can be changed by addMembersWithClientIds:callback: or removeMembersWithClientIds:callback: .

@property (nonatomic, strong, readonly, nullable) NSArray<NSString*> *members

Discussion

The ids of the clients who join the conversation. Can be changed by addMembersWithClientIds:callback: or removeMembersWithClientIds:callback: .

Declared In

AVIMConversation.h

  attributes

The attributes of the conversation. Intend to save any extra data of the conversation. Can be set when creating the conversation or can be updated by update:callback: .

@property (nonatomic, strong, readonly, nullable) NSDictionary *attributes

Discussion

The attributes of the conversation. Intend to save any extra data of the conversation. Can be set when creating the conversation or can be updated by update:callback: .

Declared In

AVIMConversation.h

  uniqueId

Unique ID of Unique Conversation.

@property (nonatomic, strong, readonly, nullable) NSString *uniqueId

Discussion

Unique ID of Unique Conversation.

Declared In

AVIMConversation.h

  unique

Indicate whether it is a unique conversation.

@property (nonatomic, assign, readonly) BOOL unique

Discussion

Indicate whether it is a unique conversation.

Declared In

AVIMConversation.h

  transient

Indicate whether it is a transient conversation.

@property (nonatomic, assign, readonly) BOOL transient

Discussion

Indicate whether it is a transient conversation.

Declared In

AVIMConversation.h

  system

Indicate whether it is a system conversation.

@property (nonatomic, assign, readonly) BOOL system

Discussion

Indicate whether it is a system conversation.

Declared In

AVIMConversation.h

  temporary

Indicate whether it is a temporary conversation.

@property (nonatomic, assign, readonly) BOOL temporary

Discussion

Indicate whether it is a temporary conversation.

Declared In

AVIMConversation.h

  temporaryTTL

Temporary Conversation’s Time to Live.

@property (nonatomic, assign, readonly) NSUInteger temporaryTTL

Discussion

Temporary Conversation’s Time to Live.

Declared In

AVIMConversation.h

  muted

Muting status. If muted, when you have offline messages, will not receive Apple APNS notification. Can be changed by muteWithCallback: or unmuteWithCallback:.

@property (nonatomic, assign, readonly) BOOL muted

Discussion

Muting status. If muted, when you have offline messages, will not receive Apple APNS notification. Can be changed by muteWithCallback: or unmuteWithCallback:.

Declared In

AVIMConversation.h

  imClient

The AVIMClient object which this conversation belongs to.

@property (nonatomic, weak, readonly, nullable) AVIMClient *imClient

Discussion

The AVIMClient object which this conversation belongs to.

Declared In

AVIMConversation.h

+ new

+ (instancetype)new

– init

- (instancetype)init

– setObject:forKey:

Add custom property for conversation.

- (void)setObject:(id _Nullable)object forKey:(NSString *)key

Parameters

object

The property value.

key

The property name.

Discussion

Add custom property for conversation.

Declared In

AVIMConversation.h

– setObject:forKeyedSubscript:

Support to use subscript to set custom property.

- (void)setObject:(id _Nullable)object forKeyedSubscript:(NSString *)key

Discussion

Support to use subscript to set custom property.

Declared In

AVIMConversation.h

– objectForKey:

Get custom property value for conversation.

- (id _Nullable)objectForKey:(NSString *)key

Parameters

key

The custom property name.

Return Value

The custom property value.

Discussion

Get custom property value for conversation.

Declared In

AVIMConversation.h

– objectForKeyedSubscript:

Support to use subscript to set custom property.

- (id _Nullable)objectForKeyedSubscript:(NSString *)key

Discussion

Support to use subscript to set custom property.

Declared In

AVIMConversation.h

– keyedConversation

创建一个 AVIMKeyedConversation 对象。用于序列化,方便保存在本地。

- (AVIMKeyedConversation *_Nullable)keyedConversation

Return Value

AVIMKeyedConversation 对象。

Discussion

创建一个 AVIMKeyedConversation 对象。用于序列化,方便保存在本地。

Declared In

AVIMConversation.h

– fetchWithCallback:

拉取服务器最新数据。

- (void)fetchWithCallback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

callback

- 结果回调

Discussion

拉取服务器最新数据。

Declared In

AVIMConversation.h

– fetchReceiptTimestampsInBackground

拉取对话最近的回执时间。

- (void)fetchReceiptTimestampsInBackground

Discussion

拉取对话最近的回执时间。

Declared In

AVIMConversation.h

– updateWithCallback:

发送更新。

- (void)updateWithCallback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

callback

- 结果回调

Discussion

发送更新。

Declared In

AVIMConversation.h

– joinWithCallback:

加入对话。

- (void)joinWithCallback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

callback

- 结果回调

Discussion

加入对话。

Declared In

AVIMConversation.h

– quitWithCallback:

离开对话。

- (void)quitWithCallback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

callback

- 结果回调

Discussion

离开对话。

Declared In

AVIMConversation.h

– muteWithCallback:

静音,不再接收此对话的离线推送。

- (void)muteWithCallback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

callback

- 结果回调

Discussion

静音,不再接收此对话的离线推送。

Declared In

AVIMConversation.h

– unmuteWithCallback:

取消静音,开始接收此对话的离线推送。

- (void)unmuteWithCallback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

callback

- 结果回调

Discussion

取消静音,开始接收此对话的离线推送。

Declared In

AVIMConversation.h

– readInBackground

将对话标记为已读。 该方法将本地对话中其他成员发出的最新消息标记为已读,该消息的发送者会收到已读通知。

- (void)readInBackground

Discussion

将对话标记为已读。 该方法将本地对话中其他成员发出的最新消息标记为已读,该消息的发送者会收到已读通知。

Declared In

AVIMConversation.h

– addMembersWithClientIds:callback:

邀请新成员加入对话。

- (void)addMembersWithClientIds:(NSArray<NSString*> *)clientIds callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

clientIds

- 成员列表

callback

- 结果回调

Discussion

邀请新成员加入对话。

Declared In

AVIMConversation.h

– removeMembersWithClientIds:callback:

从对话踢出部分成员。

- (void)removeMembersWithClientIds:(NSArray<NSString*> *)clientIds callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

clientIds

- 成员列表

callback

- 结果回调

Discussion

从对话踢出部分成员。

Declared In

AVIMConversation.h

– countMembersWithCallback:

查询成员人数(开放群组即为在线人数)。

- (void)countMembersWithCallback:(void ( ^ ) ( NSInteger count , NSError *_Nullable error ))callback

Parameters

callback

- 结果回调

Discussion

查询成员人数(开放群组即为在线人数)。

Declared In

AVIMConversation.h

– sendMessage:callback:

往对话中发送消息。

- (void)sendMessage:(AVIMMessage *)message callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

message

- 消息对象

callback

- 结果回调

Discussion

往对话中发送消息。

Declared In

AVIMConversation.h

– sendMessage:option:callback:

往对话中发送消息。

- (void)sendMessage:(AVIMMessage *)message option:(AVIMMessageOption *_Nullable)option callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

message

- 消息对象

option

- 消息发送选项

callback

- 结果回调

Discussion

往对话中发送消息。

Declared In

AVIMConversation.h

– sendMessage:progressBlock:callback:

往对话中发送消息。

- (void)sendMessage:(AVIMMessage *)message progressBlock:(void ( ^ _Nullable ) ( NSInteger progress ))progressBlock callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

message

- 消息对象

progressBlock
  • 发送进度回调。仅对文件上传有效,发送文本消息时不进行回调。
callback

- 结果回调

Discussion

往对话中发送消息。

Declared In

AVIMConversation.h

– sendMessage:option:progressBlock:callback:

往对话中发送消息。

- (void)sendMessage:(AVIMMessage *)message option:(nullable AVIMMessageOption *)option progressBlock:(void ( ^ _Nullable ) ( NSInteger progress ))progressBlock callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

message

- 消息对象

option

- 消息发送选项

progressBlock
  • 发送进度回调。仅对文件上传有效,发送文本消息时不进行回调。
callback

- 结果回调

Discussion

往对话中发送消息。

Declared In

AVIMConversation.h

– updateMessage:toNewMessage:callback:

Replace a message you sent with a new message.

- (void)updateMessage:(AVIMMessage *)oldMessage toNewMessage:(AVIMMessage *)newMessage callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

oldMessage

The message you’ve sent which will be replaced by newMessage.

newMessage

A new message.

callback

Callback of message update.

Discussion

Replace a message you sent with a new message.

Declared In

AVIMConversation.h

– recallMessage:callback:

Recall a message.

- (void)recallMessage:(AVIMMessage *)oldMessage callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error , AVIMRecalledMessage *_Nullable recalledMessage ))callback

Parameters

oldMessage

The message you’ve sent which will be replaced by newMessage.

callback

Callback of message update.

Discussion

Recall a message.

Declared In

AVIMConversation.h

– addMessageToCache:

Add a message to cache.

- (void)addMessageToCache:(AVIMMessage *)message

Parameters

message

The message to be cached.

Discussion

Add a message to cache.

Declared In

AVIMConversation.h

– removeMessageFromCache:

Remove a message from cache.

- (void)removeMessageFromCache:(AVIMMessage *)message

Parameters

message

The message which you want to remove from cache.

Discussion

Remove a message from cache.

Declared In

AVIMConversation.h

– queryMessagesFromServerWithLimit:callback:

从服务端拉取该会话的最近 limit 条消息。

- (void)queryMessagesFromServerWithLimit:(NSUInteger)limit callback:(void ( ^ ) ( NSArray<AVIMMessage*> *_Nullable messages , NSError *_Nullable error ))callback

Parameters

limit

返回结果的数量,默认 20 条,最多 1000 条。

callback

查询结果回调。

Discussion

从服务端拉取该会话的最近 limit 条消息。

Declared In

AVIMConversation.h

– queryMessagesFromCacheWithLimit:

从缓存中查询该会话的最近 limit 条消息。

- (NSArray *)queryMessagesFromCacheWithLimit:(NSUInteger)limit

Parameters

limit

返回结果的数量,默认 20 条,最多 1000 条。

Return Value

消息数组。

Discussion

从缓存中查询该会话的最近 limit 条消息。

Declared In

AVIMConversation.h

– queryMessagesWithLimit:callback:

获取该会话的最近 limit 条消息。

- (void)queryMessagesWithLimit:(NSUInteger)limit callback:(void ( ^ ) ( NSArray<AVIMMessage*> *_Nullable messages , NSError *_Nullable error ))callback

Parameters

limit

返回结果的数量,默认 20 条,最多 1000 条。

callback

查询结果回调。

Discussion

获取该会话的最近 limit 条消息。

Declared In

AVIMConversation.h

– queryMessagesBeforeId:timestamp:limit:callback:

查询历史消息,获取某条消息之前的 limit 条消息。

- (void)queryMessagesBeforeId:(NSString *)messageId timestamp:(int64_t)timestamp limit:(NSUInteger)limit callback:(void ( ^ ) ( NSArray<AVIMMessage*> *_Nullable messages , NSError *_Nullable error ))callback

Parameters

messageId

此消息以前的消息。

timestamp

此时间以前的消息。

limit

返回结果的数量,默认 20 条,最多 1000 条。

callback

查询结果回调。

Discussion

查询历史消息,获取某条消息之前的 limit 条消息。

Warning: timestamp must equal to the timestamp of the message that messageId equal to messageId, if the timestamp and messageId not match, continuity of querying message can’t guarantee.

Declared In

AVIMConversation.h

– queryMessagesInInterval:direction:limit:callback:

Query messages from a message to an another message with specified direction applied.

- (void)queryMessagesInInterval:(AVIMMessageInterval *)interval direction:(AVIMMessageQueryDirection)direction limit:(NSUInteger)limit callback:(void ( ^ ) ( NSArray<AVIMMessage*> *_Nullable messages , NSError *_Nullable error ))callback

Parameters

interval

A message interval.

direction

Direction of message query.

limit

Limit of messages you want to query.

callback

Callback of query request.

Discussion

Query messages from a message to an another message with specified direction applied.

Declared In

AVIMConversation.h

– queryMediaMessagesFromServerWithType:limit:fromMessageId:fromTimestamp:callback:

Query Specific Media Type Message from Server.

- (void)queryMediaMessagesFromServerWithType:(AVIMMessageMediaType)type limit:(NSUInteger)limit fromMessageId:(NSString *_Nullable)messageId fromTimestamp:(int64_t)timestamp callback:(void ( ^ ) ( NSArray<AVIMMessage*> *_Nullable messages , NSError *_Nullable error ))callback

Parameters

type

Specific Media Type you want to query, see AVIMMessageMediaType.

limit

Limit of messages you want to query.

messageId

If set it and MessageId is Valid, the Query Result is Decending base on Timestamp and will Not Include the Message that its messageId is this parameter.

timestamp

Set Zero or Negative, it will query from latest Message and result include the latest Message; Set a valid timestamp, the Query Result is Decending base on Timestamp and will Not Include the Message that its timestamp is this parameter.

callback

Result callback.

Discussion

Query Specific Media Type Message from Server.

Declared In

AVIMConversation.h

– getAllMemberInfoWithCallback:

Get all member info. using cache as a default.

- (void)getAllMemberInfoWithCallback:(void ( ^ ) ( NSArray<AVIMConversationMemberInfo*> *_Nullable memberInfos , NSError *_Nullable error ))callback

Parameters

callback

Result callback.

Discussion

Get all member info. using cache as a default.

Declared In

AVIMConversation.h

– getAllMemberInfoWithIgnoringCache:callback:

Get all member info.

- (void)getAllMemberInfoWithIgnoringCache:(BOOL)ignoringCache callback:(void ( ^ ) ( NSArray<AVIMConversationMemberInfo*> *_Nullable memberInfos , NSError *_Nullable error ))callback

Parameters

ignoringCache

Cache option.

callback

Result callback.

Discussion

Get all member info.

Declared In

AVIMConversation.h

– getMemberInfoWithMemberId:callback:

Get a member info by member id. using cache as a default.

- (void)getMemberInfoWithMemberId:(NSString *)memberId callback:(void ( ^ ) ( AVIMConversationMemberInfo *_Nullable memberInfo , NSError *_Nullable error ))callback

Parameters

memberId

Equal to client id.

callback

Result callback.

Discussion

Get a member info by member id. using cache as a default.

Declared In

AVIMConversation.h

– getMemberInfoWithIgnoringCache:memberId:callback:

Get a member info by member id.

- (void)getMemberInfoWithIgnoringCache:(BOOL)ignoringCache memberId:(NSString *)memberId callback:(void ( ^ ) ( AVIMConversationMemberInfo *_Nullable memberInfo , NSError *_Nullable error ))callback

Parameters

ignoringCache

Cache option.

memberId

Equal to client id.

callback

Result callback.

Discussion

Get a member info by member id.

Declared In

AVIMConversation.h

– updateMemberRoleWithMemberId:role:callback:

Change a member’s role.

- (void)updateMemberRoleWithMemberId:(NSString *)memberId role:(AVIMConversationMemberRole)role callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

memberId

Equal to client id.

role

Changing role.

callback

Result callback.

Discussion

Change a member’s role.

Declared In

AVIMConversation.h

– blockMembers:callback:

Blocking some members in the conversation.

- (void)blockMembers:(NSArray<NSString*> *)memberIds callback:(void ( ^ ) ( NSArray<NSString*> *_Nullable successfulIds , NSArray<AVIMOperationFailure*> *_Nullable failedIds , NSError *_Nullable error ))callback

Parameters

memberIds

Who will be blocked.

callback

Result callback.

Discussion

Blocking some members in the conversation.

Declared In

AVIMConversation.h

– unblockMembers:callback:

Unblocking some members in the conversation.

- (void)unblockMembers:(NSArray<NSString*> *)memberIds callback:(void ( ^ ) ( NSArray<NSString*> *_Nullable successfulIds , NSArray<AVIMOperationFailure*> *_Nullable failedIds , NSError *_Nullable error ))callback

Parameters

memberIds

Who will be unblocked.

callback

Result callback.

Discussion

Unblocking some members in the conversation.

Declared In

AVIMConversation.h

– queryBlockedMembersWithLimit:next:callback:

Query blocked members in the conversation.

- (void)queryBlockedMembersWithLimit:(NSInteger)limit next:(NSString *_Nullable)next callback:(void ( ^ ) ( NSArray<NSString*> *_Nullable blockedMemberIds , NSString *_Nullable next , NSError *_Nullable error ))callback

Parameters

limit

Count of the blocked members you want to query.

next

Offset, if callback’s next is nil or empty, that means there is no more blocked members.

callback

Result callback.

Discussion

Query blocked members in the conversation.

Declared In

AVIMConversation.h

– muteMembers:callback:

Muting some members in the conversation.

- (void)muteMembers:(NSArray<NSString*> *)memberIds callback:(void ( ^ ) ( NSArray<NSString*> *_Nullable successfulIds , NSArray<AVIMOperationFailure*> *_Nullable failedIds , NSError *_Nullable error ))callback

Parameters

memberIds

Who will be muted.

callback

Result callback.

Discussion

Muting some members in the conversation.

Declared In

AVIMConversation.h

– unmuteMembers:callback:

Unmuting some members in the conversation.

- (void)unmuteMembers:(NSArray<NSString*> *)memberIds callback:(void ( ^ ) ( NSArray<NSString*> *_Nullable successfulIds , NSArray<AVIMOperationFailure*> *_Nullable failedIds , NSError *_Nullable error ))callback

Parameters

memberIds

Who will be unmuted.

callback

Result callback.

Discussion

Unmuting some members in the conversation.

Declared In

AVIMConversation.h

– queryMutedMembersWithLimit:next:callback:

Query muted members in the conversation.

- (void)queryMutedMembersWithLimit:(NSInteger)limit next:(NSString *_Nullable)next callback:(void ( ^ ) ( NSArray<NSString*> *_Nullable blockedMemberIds , NSString *_Nullable next , NSError *_Nullable error ))callback

Parameters

limit

Count of the muted members you want to query.

next

Offset, if callback’s next is nil or empty, that means there is no more muted members.

callback

Result callback.

Discussion

Query muted members in the conversation.

Declared In

AVIMConversation.h

AVDeprecated Methods

– sendMessage:options:callback:

往对话中发送消息。

- (void)sendMessage:(AVIMMessage *)message options:(AVIMMessageSendOption)options callback:(AVIMBooleanResultBlock)callback

Parameters

message

- 消息对象

options

- 可选参数,可以使用或 “|” 操作表示多个选项

callback

- 结果回调

Discussion

往对话中发送消息。

Declared In

AVIMConversation.h

– sendMessage:options:progressBlock:callback:

往对话中发送消息。

- (void)sendMessage:(AVIMMessage *)message options:(AVIMMessageSendOption)options progressBlock:(nullable AVIMProgressBlock)progressBlock callback:(AVIMBooleanResultBlock)callback

Parameters

message

- 消息对象

options

- 可选参数,可以使用或 “|” 操作表示多个选项

progressBlock
  • 发送进度回调。仅对文件上传有效,发送文本消息时不进行回调。
callback

- 结果回调

Discussion

往对话中发送消息。

Declared In

AVIMConversation.h

– update:callback:

发送更新。

- (void)update:(NSDictionary *)updateDict callback:(void ( ^ ) ( BOOL succeeded , NSError *_Nullable error ))callback

Parameters

updateDict

- 需要更新的数据,可通过 AVIMConversationUpdateBuilder 生成

callback

- 结果回调

Discussion

发送更新。

Declared In

AVIMConversation.h

– markAsReadInBackground

标记该会话已读。 将服务端该会话的未读消息数置零。

- (void)markAsReadInBackground

Discussion

标记该会话已读。 将服务端该会话的未读消息数置零。

Declared In

AVIMConversation.h