Browse SDKs · iOS
Platform
SDKsiOSEnterprise

Update a conversation group

Update a conversation group with Open_im_sdkUpdateConversationGroup.

Copy

Invoke Open_im_sdkUpdateConversationGroup to modify the name, custom extension string, or visibility status of an existing conversation group:

Parameters

ParameterTypeRequiredDescription
conversationGroupIDNSString *YesTarget conversation group ID.
nameNSString *NoNew conversation group name.
exNSString *NoNew custom extension string.
hiddenNSNumber *NoWhether to hide this group in navigation interfaces (wrapped BOOL).

Code example

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

NSDictionary *request = @{
    @"conversationGroupID": @"group_work_101",
    @"name": @"Priority Work",
    @"hidden": @NO,
};

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 upsertConversationGroupJSON:data];
    }
    onFailure:^(NSInteger code, NSString * _Nullable message) {
        NSLog(@"UpdateConversationGroup failed: %ld %@", (long)code, message);
    }];

Open_im_sdkUpdateConversationGroup(callback, requestJSON);

Return value

The onSuccess callback delivers the updated group JSON string in data. The client updates the local cache using conversationGroupID as the unique identifier.

State changes after the call

  1. Local state update: The client updates local group properties corresponding to conversationGroupID.
  2. Event notification: Synchronized updates across devices broadcast via the onConversationGroupChanged: listener callback.
  3. Re-query calibration: For listener registration and event handling details, refer to Conversation groups overview.