SDKsiOSEnterprise
Retrieve conversations in a group
Retrieve a conversation group and its conversations by page with Open_im_sdkGetConversationGroupInfoWithConversations.
Invoke Open_im_sdkGetConversationGroupInfoWithConversations to retrieve detailed information for a specified conversation group and its contained conversations with pagination:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationGroupID | NSString * | Yes | Target conversation group ID. |
pagination.pageNumber | NSInteger | Yes | Page index, starting from 1. |
pagination.showNumber | NSInteger | Yes | Page size (number of conversations per page). |
Code example
#import <OpenIMSDK/CallbackProxy.h>
@import OpenIMCore;
NSDictionary *request = @{
@"conversationGroupID": @"group_work_101",
@"pagination": @{ @"pageNumber": @1, @"showNumber": @20 },
};
NSData *requestData = [NSJSONSerialization dataWithJSONObject:request options:0 error:nil];
NSString *requestJSON = [[NSString alloc] initWithData:requestData
encoding:NSUTF8StringEncoding];
CallbackProxy *callback = [[CallbackProxy alloc]
initWithOnSuccess:^(NSString * _Nullable data) {
if (data == nil) {
return;
}
[self handleGroupConversationsPageJSON:data];
}
onFailure:^(NSInteger code, NSString * _Nullable message) {
NSLog(@"GetConversationGroupInfoWithConversations failed: %ld %@", (long)code, message);
}];
Open_im_sdkGetConversationGroupInfoWithConversations(callback, requestJSON);Return value
The onSuccess callback delivers a JSON string in data containing group (group metadata), conversationElems (conversation objects for the requested page), and isEnd (boolean indicating whether the end of the list has been reached).
State changes after the call
- Snapshot query: This method queries a point-in-time snapshot and does not trigger listener callbacks.
- Pagination state: Use
isEndto determine whether more pages should be loaded. - Event notification: Changes to group membership broadcast through
onConversationGroupMemberAdded:andonConversationGroupMemberDeleted:. For listener handling, refer to Conversation groups overview.
Was this page helpful?