SDKsiOSEnterprise
Remove conversations from groups
Remove conversation-group relationships with Open_im_sdkRemoveConversationsFromGroups.
Invoke Open_im_sdkRemoveConversationsFromGroups to remove specified conversations from one or more conversation groups. This operation removes group associations only; it does not delete conversations or clear message history:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationIDs | NSArray<NSString *> * | Yes | List of conversation IDs to remove from the groups. |
conversationGroupIDs | NSArray<NSString *> * | Yes | List of target conversation group IDs. |
Code example
#import <OpenIMSDK/CallbackProxy.h>
@import OpenIMCore;
NSData *conversationData =
[NSJSONSerialization dataWithJSONObject:@[@"c2c_user1002"] options:0 error:nil];
NSString *conversationIDsJSON =
[[NSString alloc] initWithData:conversationData encoding:NSUTF8StringEncoding];
NSData *groupData =
[NSJSONSerialization dataWithJSONObject:@[@"group_work_101"] options:0 error:nil];
NSString *groupIDsJSON =
[[NSString alloc] initWithData:groupData encoding:NSUTF8StringEncoding];
CallbackProxy *callback = [[CallbackProxy alloc]
initWithOnSuccess:^(NSString * _Nullable data) {
NSLog(@"RemoveConversationsFromGroups success");
}
onFailure:^(NSInteger code, NSString * _Nullable message) {
NSLog(@"RemoveConversationsFromGroups failed: %ld %@", (long)code, message);
}];
Open_im_sdkRemoveConversationsFromGroups(callback, conversationIDsJSON, groupIDsJSON);Return value
The onSuccess callback returns confirmation when the disassociation request completes.
State changes after the call
- Local state update: The client removes member associations keyed by composite pairs of
conversationGroupIDandconversationID. - Event notification: Active client sessions receive removal notifications via the
onConversationGroupMemberDeleted:listener callback. - Re-query calibration: For listener lifecycle and integration details, refer to Conversation groups overview.
Was this page helpful?