Browse SDKs · iOS
SDKsiOS

Update the group name, description, and avatar

Update a group’s basic display profile with OpenIM iOS SDK.

Copy

setGroupInfo:onSuccess:onFailure: accepts a complete OIMGroupInfo. Retrieve and retain the latest object first, then modify only fields owned by the profile editor. This prevents default scalar values from overwriting join-verification or member-permission settings.

OIMGroupInfo *group = latestGroup;
group.groupName = groupName;
group.introduction = introduction;
group.faceURL = avatarURL;

[[OIMManager manager] setGroupInfo:group
    onSuccess:^(NSString * _Nullable data) { [self showSaved]; }
    onFailure:^(NSInteger code, NSString *message) {
        [self showErrorCode:code message:message];
    }];

A successful callback means that the update request has completed; it does not mean that every client has received the change. Reconcile the final profile through onGroupInfoChanged: or a new query. For the complete delegate, see Groups overview.