Browse SDKs · iOS
Platform
SDKsiOSEnterprise

Set conversation-group order

Set the order of multiple conversation groups with Open_im_sdkSetConversationGroupOrder.

Copy

Invoke Open_im_sdkSetConversationGroupOrder to update display ordering indexes for multiple conversation groups in a batch:

Parameters

ParameterTypeRequiredDescription
conversationGroupIDNSString *YesTarget conversation group ID within each order entry.
orderNSNumber *YesNew numeric ordering index.

Code example

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

NSArray *orders = @[
    @{ @"conversationGroupID": @"group_work_101", @"order": @100 },
    @{ @"conversationGroupID": @"group_life_102", @"order": @200 },
];

NSData *requestData = [NSJSONSerialization dataWithJSONObject:orders options:0 error:nil];
NSString *requestJSON = [[NSString alloc] initWithData:requestData
                                              encoding:NSUTF8StringEncoding];

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

Open_im_sdkSetConversationGroupOrder(callback, requestJSON);

Return value

The onSuccess callback returns confirmation when the ordering request is completed.

State changes after the call

  1. Local state update: The client updates the order property for matching groups keyed by conversationGroupID and re-sorts the group list.
  2. Event notification: Group property changes broadcast via the onConversationGroupChanged: listener callback across client sessions.
  3. Re-query calibration: For listener integration details, refer to Conversation groups overview.