Browse SDKs · iOS
Platform
SDKsiOS

Update a group member’s avatar

Update a specified member’s avatar within a group with OpenIM iOS SDK.

Copy

Invoke setGroupMemberInfo:onSuccess:onFailure: with a parameter dictionary containing faceURL to configure a group-specific avatar for a member:

Parameters

ParameterTypeRequiredDescription
groupMemberInfoDictionaryNSDictionary *YesDictionary containing member identification and updated avatar URL.

Dictionary keys

ParameterTypeRequiredDescription
groupIDNSString *YesTarget group ID.
userIDNSString *YesTarget member user ID.
faceURLNSString *YesNew avatar URL for the member in this group.

Code example

NSDictionary *updates = @{
    @"groupID": @"group_1001",
    @"userID": @"user_003",
    @"faceURL": @"https://example.com/avatar/group_user_003.png"
};

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

Return value

The onSuccess callback returns confirmation when the server accepts the avatar update.

State changes after the call

  1. Local state update: The client updates the member's avatar attribute matching groupID:userID. This avatar is scoped strictly to the current group and does not change the user's global profile avatar.
  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.