SDKsiOSEnterprise
Load message history in reverse
Retrieve history toward newer messages from an anchor with OpenIM iOS SDK.
When messages after an anchor need to be filled in, use the reverse selector with the same OIMGetAdvancedHistoryMessageListParam model:
OIMGetAdvancedHistoryMessageListParam *param = [OIMGetAdvancedHistoryMessageListParam new];
param.conversationID = conversationID;
param.startClientMsgID = anchorMessage.clientMsgID;
param.count = 20;
param.viewType = OIMGetHistoryViewTypeHistory;
[[OIMManager manager] getAdvancedHistoryMessageListReverse:param
onSuccess:^(OIMGetAdvancedHistoryMessageListInfo *result) {
[self appendMessages:result.messageList ?: @[]];
}
onFailure:nil];Do not arbitrarily alternate directions at the same scroll boundary. The success callback and new-message delegate are separate stages. Merge results by conversationID:clientMsgID.
Was this page helpful?