SDKsiOS
Retrieve conversations by ID
Batch-retrieve conversations by conversationID with OpenIM iOS SDK.
Batch-retrieve conversation snapshots for a list of conversation identifiers using getMultipleConversation:onSuccess:onFailure:.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationIDs | NSArray<NSString *> * | Yes | List of conversation IDs to retrieve. |
Code example
[[OIMManager manager] getMultipleConversation:@[@"c2c_user1001", @"group_group2001"]
onSuccess:^(NSArray<OIMConversationInfo *> *items) {
[conversationStore mergeByConversationID:items ?: @[]];
}
onFailure:^(NSInteger code, NSString *message) {
NSLog(@"getMultipleConversation failed: %ld %@", (long)code, message);
}];Return value
The onSuccess callback delivers an NSArray<OIMConversationInfo *> * containing the matching conversation objects. If none of the requested IDs exist, an empty array is returned.
If certain requested conversations have not yet been created, the returned array will omit those entries. The order of elements in the response array is not guaranteed to align positionally with the input list.
State changes after the call
- Local state merge: Merge returned records into local conversation collections using
conversationIDas the unique entity key. - Snapshot query: This query establishes an instantaneous point-in-time snapshot and does not emit conversation delegate events.
- Ongoing synchronization: Real-time property updates for these conversations continue to arrive via
OIMConversationListener(see Retrieve the conversation list).
Was this page helpful?