Browse SDKs · iOS
Platform
SDKsiOS

Transfer group ownership

Transfer group ownership to another member with the Objective-C API.

Copy

Invoke transferGroupOwner:newOwner:onSuccess:onFailure: to transfer group ownership to another existing member (only the current group owner has permission to perform this action):

Parameters

ParameterTypeRequiredDescription
groupIDNSString *YesTarget group ID.
newOwnerNSString *YesUser ID of the new group owner.

Code example

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

Return value

The onSuccess callback returns confirmation when the server completes the ownership transfer.

State changes after the call

  1. Role transition: The former owner is demoted to a regular member, while the designated member is promoted to group owner. Both role updates broadcast via onGroupMemberInfoChanged:.
  2. Local state merge: Merge updated roles for both affected users using groupID:userID. To refresh the management list immediately, call Retrieve the group owner and administrators.
  3. Leaving the group: A group owner wishing to exit must transfer ownership before calling Leave a group, or dissolve the group with Dismiss a group.