Browse SDKs · iOS
Platform
SDKsiOS

Check whether the current user joined a group

Check whether the current user has joined a specified iOS group.

Copy

Invoke isJoinedGroup:onSuccess:onFailure: to check whether the currently signed-in user is a member of a specified group:

Parameters

ParameterTypeRequiredDescription
groupIDNSString *YesTarget group ID to inspect.

Code example

[[OIMManager manager] isJoinedGroup:@"group_1001"
                          onSuccess:^(BOOL joined) {
                              [self updateJoinedState:joined];
                          }
                          onFailure:^(NSInteger code, NSString *message) {
                              NSLog(@"isJoinedGroup failed: %ld %@", (long)code, message);
                          }];

Return value

The onSuccess callback delivers a boolean flag joined. YES indicates that the user is currently a group member; NO indicates that the user is not in the group or has departed.

State changes after the call

  1. Lightweight check: This method queries an instantaneous membership flag without triggering group delegate callbacks.
  2. Operations and events: To join or leave a group, refer to Apply to join a group and Leave a group. For membership change events, refer to Groups overview.