SDKsiOSEnterprise
Retrieve conversation groups
Retrieve conversation groups by type with Open_im_sdkGetConversationGroups.
Invoke Open_im_sdkGetConversationGroups to query the list of conversation groups belonging to the signed-in user by category:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupType | int64_t | Yes | Category of conversation groups to retrieve. |
Group type enumeration
| Value | Numeric value | Description |
|---|---|---|
0 | 0 | Regular custom groups manually created and managed by users. |
1 | 1 | Rule-filtered groups maintained automatically. |
2 | 2 | All group categories. |
Code example
#import <OpenIMSDK/CallbackProxy.h>
@import OpenIMCore;
int64_t groupType = 2; // 0: regular, 1: filtered, 2: all
CallbackProxy *callback = [[CallbackProxy alloc]
initWithOnSuccess:^(NSString * _Nullable data) {
[self replaceConversationGroupsFromJSON:data];
}
onFailure:^(NSInteger code, NSString * _Nullable message) {
NSLog(@"GetConversationGroups failed: %ld %@", (long)code, message);
}];
Open_im_sdkGetConversationGroups(callback, groupType);Return value
The onSuccess callback delivers a JSON array string in data containing the matching group objects. Parse the array and update the local in-memory group list keyed by conversationGroupID.
State changes after the call
- Snapshot query: This method provides an initial snapshot of group metadata without triggering asynchronous listener events.
- Event notification: Real-time modifications to groups across sessions or devices arrive via listener delegates. For listener registration and lifecycle details, refer to Conversation groups overview.
Was this page helpful?