Browse SDKs · iOS
Platform
SDKsiOSEnterprise

Retrieve the groups containing a conversation

Retrieve the complete groups containing a conversation with Open_im_sdkGetConversationGroupByConversationID.

Copy

Invoke Open_im_sdkGetConversationGroupByConversationID to retrieve the list of conversation groups that contain a specified conversation. A single conversation can belong to multiple groups simultaneously:

Parameters

ParameterTypeRequiredDescription
conversationIDNSString *YesTarget conversation ID.

Code example

#import <OpenIMSDK/CallbackProxy.h>
@import OpenIMCore;

CallbackProxy *callback = [[CallbackProxy alloc]
    initWithOnSuccess:^(NSString * _Nullable data) {
        [self mergeConversationGroupsJSON:data];
    }
    onFailure:^(NSInteger code, NSString * _Nullable message) {
        NSLog(@"GetConversationGroupByConversationID failed: %ld %@", (long)code, message);
    }];

Open_im_sdkGetConversationGroupByConversationID(callback, @"c2c_user1002");

Return value

The onSuccess callback delivers a JSON array string in data representing complete group objects containing this conversation (rather than a list of ID strings alone).

State changes after the call

  1. Snapshot query: This method retrieves an instantaneous membership snapshot and does not trigger asynchronous listener callbacks.
  2. Event notification: Membership modifications broadcast via onConversationGroupMemberAdded: and onConversationGroupMemberDeleted:.
  3. Re-query calibration: For listener integration details, refer to Conversation groups overview.