Browse SDKs · iOS
Platform
SDKsiOSEnterprise

Remove conversations from groups

Remove conversation-group relationships with Open_im_sdkRemoveConversationsFromGroups.

Copy

Invoke Open_im_sdkRemoveConversationsFromGroups to remove specified conversations from one or more conversation groups. This operation removes group associations only; it does not delete conversations or clear message history:

Parameters

ParameterTypeRequiredDescription
conversationIDsNSArray<NSString *> *YesList of conversation IDs to remove from the groups.
conversationGroupIDsNSArray<NSString *> *YesList of target conversation group IDs.

Code example

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

NSData *conversationData =
    [NSJSONSerialization dataWithJSONObject:@[@"c2c_user1002"] options:0 error:nil];
NSString *conversationIDsJSON =
    [[NSString alloc] initWithData:conversationData encoding:NSUTF8StringEncoding];

NSData *groupData =
    [NSJSONSerialization dataWithJSONObject:@[@"group_work_101"] options:0 error:nil];
NSString *groupIDsJSON =
    [[NSString alloc] initWithData:groupData encoding:NSUTF8StringEncoding];

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

Open_im_sdkRemoveConversationsFromGroups(callback, conversationIDsJSON, groupIDsJSON);

Return value

The onSuccess callback returns confirmation when the disassociation request completes.

State changes after the call

  1. Local state update: The client removes member associations keyed by composite pairs of conversationGroupID and conversationID.
  2. Event notification: Active client sessions receive removal notifications via the onConversationGroupMemberDeleted: listener callback.
  3. Re-query calibration: For listener lifecycle and integration details, refer to Conversation groups overview.