Browse SDKs · iOS
Platform
SDKsiOSEnterprise

Set the burn-after-reading duration

Set a conversation’s burn-after-reading duration with OpenIM iOS SDK.

Copy

Configure the message destruction countdown duration for private chats using setConversationBurnDuration:duration:onSuccess:onFailure:.

Parameters

ParameterTypeRequiredDescription
conversationIDNSString *YesTarget conversation identifier.
durationNSIntegerYesBurn countdown interval in seconds (e.g., 30).

Code example

[[OIMManager manager] setConversationBurnDuration:@"c2c_user1002"
                                         duration:30
                                        onSuccess:^(NSString * _Nullable data) {
                                            NSLog(@"setConversationBurnDuration success");
                                        }
                                        onFailure:^(NSInteger code, NSString *message) {
                                            NSLog(@"setConversationBurnDuration failed: %ld %@", (long)code, message);
                                        }];

Return value

The onSuccess callback signifies that OpenIMServer updated the burn-after-reading countdown duration.

State changes after the call

  • Local state merge: Merge the updated burnDuration property into local conversation records using conversationID as the entity key.
  • Asynchronous event listening: Linked devices observe updates via onConversationChanged: in OIMConversationListener (see Retrieve the conversation list).
  • Feature boundary: This setting adjusts the message destruction timer specifically for private chats; enabling or disabling private chat mode is managed in Enable or disable burn after reading, and enterprise message expiration cycles are configured in Set the server message deletion cycle.