SDKsiOS
Check whether the current user joined a group
Check whether the current user has joined a specified iOS group.
Invoke isJoinedGroup:onSuccess:onFailure: to check whether the currently signed-in user is a member of a specified group:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupID | NSString * | Yes | Target 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
- Lightweight check: This method queries an instantaneous membership flag without triggering group delegate callbacks.
- 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.
Was this page helpful?