Browse SDKs · iOS
SDKsiOSEnterprise

Retrieve conversation groups

Retrieve conversation groups by type with Open_im_sdkGetConversationGroups.

Copy

Use Open_im_sdkGetConversationGroups to establish a complete snapshot of the current user's conversation groups for a specified type.

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) {
        [self showConversationGroupError:code message:message ?: @"Failed to retrieve conversation groups"];
    }];

Pass callback and groupType to Open_im_sdkGetConversationGroups. Use 0 for regular custom groups and 2 to retrieve all types.

Result

The success callback's data is a JSON array of groups. After parsing it, cache groups by conversationGroupID. iOS Core does not provide a corresponding high-level Objective-C model.

The query only establishes a snapshot and does not trigger the conversation-group listener. For subsequent incremental updates, see Conversation groups overview.