Browse SDKs · iOS
Platform
SDKsiOS

Set the group-member extension field

Set an application-defined extension string for a specified group member with OpenIM iOS SDK.

Copy

Invoke setGroupMemberInfo:onSuccess:onFailure: with a parameter dictionary containing ex to set custom application-defined extension data for a specified group member:

Parameters

ParameterTypeRequiredDescription
groupMemberInfoDictionaryNSDictionary *YesDictionary containing member identification and updated extension string.

Dictionary keys

ParameterTypeRequiredDescription
groupIDNSString *YesTarget group ID.
userIDNSString *YesTarget member user ID.
exNSString *YesCustom extension string (typically formatted as JSON).

Code example

NSDictionary *updates = @{
    @"groupID": @"group_1001",
    @"userID": @"user_003",
    @"ex": @"{\"level\":5,\"title\":\"Technical Lead\"}"
};

[[OIMManager manager] setGroupMemberInfo:updates
                               onSuccess:^(NSString * _Nullable data) {
                                   NSLog(@"setGroupMemberInfo ex success");
                               }
                               onFailure:^(NSInteger code, NSString *message) {
                                   NSLog(@"setGroupMemberInfo ex failed: %ld %@", (long)code, message);
                               }];

Return value

The onSuccess callback returns confirmation when the server saves the member extension string.

State changes after the call

  1. Local state update: The client updates the member's ex attribute matching groupID:userID. The write operation completely replaces the stored extension string without merging nested keys.
  2. Event notification: Updated member details broadcast across active client sessions through onGroupMemberInfoChanged:.
  3. Re-query calibration: For member queries, refer to Group member queries overview.