Conversation groups overview
Understand conversation-group data boundaries and listener lifecycle in OpenIM iOS SDK.
Conversation groups categorize and organize the signed-in user's conversation list. They manage relationships between conversationID values and custom groups, without creating chat groups, modifying member lists, or changing message delivery targets.
The iOS SDK exposes conversation-group capabilities through OpenIMCore Objective-C functions distributed with OpenIMSDK; they are not yet wrapped in high-level OIMManager model classes. Requests, results, and listener payloads are JSON NSString values. Parse them using NSJSONSerialization rather than declaring custom model classes.
Group types
| Value | Meaning |
|---|---|
0 | Regular custom group, created and managed manually by the user. |
1 | Rule-filtered group, maintained automatically by server or SDK rules. |
2 | All group types, used strictly as a query filter parameter and not for group creation. |
Use type 0 for user-defined categories. The generation rules for filtered groups depend on backend configuration.
Available operations
- Create a conversation group
- Retrieve conversation groups
- Retrieve conversations in a group
- Retrieve group IDs containing a conversation
- Update a conversation group
- Set conversation-group order
- Add conversations to groups
- Remove conversations from groups
- Delete a conversation group
Set the conversation-group listener
Open_im_sdkSetConversationGroupListener maintains a single active Open_im_sdk_callbackOnConversationGroupListener instance. Because there is no separate unregister function, retain the listener within an account-scoped manager and initialize it once during session startup.
#import <OpenIMSDK/CallbackProxy.h>
@import OpenIMCore;
@interface ConversationGroupStore () <Open_im_sdk_callbackOnConversationGroupListener>
@end
@implementation ConversationGroupStore
- (void)startListening {
Open_im_sdkSetConversationGroupListener(self);
}
- (void)onConversationGroupAdded:(NSString * _Nullable)json {
[self mergeConversationGroupsJSON:json];
}
- (void)onConversationGroupChanged:(NSString * _Nullable)json {
[self mergeConversationGroupsJSON:json];
}
- (void)onConversationGroupDeleted:(NSString * _Nullable)json {
[self removeConversationGroupsJSON:json];
}
- (void)onConversationGroupMemberAdded:(NSString * _Nullable)json {
[self mergeConversationGroupMembersJSON:json];
}
- (void)onConversationGroupMemberDeleted:(NSString * _Nullable)json {
[self removeConversationGroupMembersJSON:json];
}
@endThe group added, changed, and deleted callbacks pass JSON arrays of groups. Member modification callbacks provide JSON containing group, conversationIDs, and conversations. Merge group state using conversationGroupID as the primary key, and identify member associations using composite keys of conversationGroupID and conversationID.
When switching accounts, stop the active listener from dispatching to UI components and register the new account's listener. Method execution completion, listener event delivery, and cache calibration queries are three distinct stages.
Was this page helpful?