SDKsiOSEnterprise
Periodically delete server-side messages
Enable or disable periodic server-side message deletion for a conversation with OpenIM iOS SDK.
Invoke setConversationIsMsgDestruct:isMsgDestruct:onSuccess:onFailure: to enable or disable the periodic automatic deletion policy for server-stored historical messages in a specified conversation:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | NSString * | Yes | Target conversation ID. |
isMsgDestruct | BOOL | Yes | Whether to enable periodic server-side message deletion. Pass YES to enable, or NO to disable. |
Code example
[[OIMManager manager] setConversationIsMsgDestruct:@"c2c_user1002"
isMsgDestruct:YES
onSuccess:^(NSString * _Nullable data) {
NSLog(@"setConversationIsMsgDestruct success");
}
onFailure:^(NSInteger code, NSString *message) {
NSLog(@"setConversationIsMsgDestruct failed: %ld %@", (long)code, message);
}];Return value
The onSuccess callback returns confirmation when the operation succeeds.
State changes after the call
- Local state update: The conversation's
isMsgDestructattribute is updated locally and synchronized with the backend. - Event notification: Updated conversation properties are broadcast via the
onConversationChanged:delegate callback. Match items byconversationIDto update local state and toggle controls. - Re-query calibration: This switch controls server-side message retention, which functions independently from client-side burn-after-reading. The actual duration before deletion is configured using Set the server-side message deletion period. For conversation listener setup, refer to Retrieve conversation list.
Was this page helpful?