Browse SDKs · iOS
SDKsiOS

Find messages by ID

Locate messages by conversationID and clientMsgID with OpenIM iOS SDK.

Copy
OIMFindMessageListParam *query = [OIMFindMessageListParam new];
query.conversationID = conversationID;
query.clientMsgIDList = @[clientMsgID];

[[OIMManager manager] findMessageList:@[query]
    onSuccess:^(OIMSearchResultInfo *result) {
        OIMSearchResultItemInfo *item = result.findResultItems.firstObject;
        OIMMessageInfo *message = item.messageList.firstObject;
        if (message != nil) [self openMessage:message conversationID:item.conversationID];
    }
    onFailure:nil];

The success result may be nil. It may also contain no match if the local cache has not synchronized yet, the message was deleted, or the ID does not exist. One call can contain criteria for multiple conversations. Do not assume that input and response arrays correspond positionally; match results by conversationID and clientMsgID. The query itself does not trigger a message delegate.