SDKsiOSEnterprise
Set the server-side message deletion period
Set the periodic deletion interval for a conversation’s server-side messages with OpenIM iOS SDK.
Invoke setConversationMsgDestructTime:msgDestructTime:onSuccess:onFailure: to configure the periodic retention cycle for messages stored on the server for a specified conversation:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | NSString * | Yes | Target conversation ID. |
msgDestructTime | NSInteger | Yes | Duration before messages are deleted on the server, specified in seconds. |
Code example
[[OIMManager manager] setConversationMsgDestructTime:@"c2c_user1002"
msgDestructTime:86400
onSuccess:^(NSString * _Nullable data) {
NSLog(@"setConversationMsgDestructTime success");
}
onFailure:^(NSInteger code, NSString *message) {
NSLog(@"setConversationMsgDestructTime 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
msgDestructTimeattribute is updated locally and synchronized with the backend. - Event notification: Updated conversation properties are broadcast via the
onConversationChanged:delegate callback. Match items byconversationIDto refresh local cache and settings displays. - Re-query calibration: This property defines the time interval before server messages are pruned. Whether automatic destruction is active depends on the toggle configured in Periodically delete server-side messages. For conversation listener setup, refer to Retrieve conversation list.
Was this page helpful?