清除消息未读状态
超级群业务可以在多个客户端之间同步消息阅读状态。
同步消息已读状态
调用同步已读状态接口会同时清除本地与服务端记录的消息的未读状态,同时服务端会将最新状态同步给同一用户账号的其他客户端。
- 如果指定了频道 ID(
channelId
),则标记该频道所有消息为全部已读,并同步其他客户端。 - 如果频道 ID 为空,则标记该超级群会话下所有不属于任何频道的消息为全部已读,并同步其他客户端。
提示
超级群暂不支持按时间戳同步已读状态。调用 syncUltraGroupReadStatus
会按指定参数的要求标记全部消息为已读。时间戳参数(timestamp
)无效,可传入任意数字。
接口原型
Objective C
- (void)syncUltraGroupReadStatus:(NSString *)targetId
channelId:(NSString *)channelId
time:(long long)timestamp
success:(void (^)(void))successBlock
error:(void (^)(RCErrorCode errorCode))errorBlock
参数说明
参数 | 类型 | 说明 |
---|---|---|
targetId | NSString | 超级群会话 targetId。 |
channelId | NSString | 超级群会话频道 channelId。 |
timestamp | long long | 该字段无效,可传入任意数字。 |
successBlock | Block | 同步消息已读状态成功的回调。 |
errorCode | Block | 同步消息已读状态失败的回调 |
示例代码
Objective C
[[RCChannelClient sharedChannelManager] syncUltraGroupReadStatus:@"targetId" channelId:@"channelId" time:0 success:^{
} error:^(RCErrorCode errorCode) {
}];