Browse SDKs · iOS
Platform
SDKsiOS

Leave a group

Leave a specified OpenIM group on iOS.

Copy

Invoke quitGroup:onSuccess:onFailure: to voluntarily leave a specified group:

Parameters

ParameterTypeRequiredDescription
groupIDNSString *YesTarget group ID. Regular members and administrators can exit directly; group owners must transfer ownership first via Transfer group ownership.

Code example

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

Return value

The onSuccess callback returns confirmation when the server accepts the group departure.

State changes after the call

  1. Local state removal: The client removes the group corresponding to groupID from the locally cached joined group collection.
  2. Event notification: Active client sessions receive notifications through the onJoinedGroupDeleted: listener callback.
  3. Re-query calibration: For group listener lifecycle details, refer to Groups overview.