Skip to main content

Recall Message

After successfully sending a message via the app, a user may discover issues like incorrect content and wish to recall the message, removing it from the recipient's message history. IMKit provides a built-in message recall feature by default.

tip

When a message is recalled, IMKit replaces the original message in the chat history with a recall notification message (RCRecallNotificationMessage) that has an objectName of RC:RcNtf. For details, refer to the server-side documentation Notification Message Format.

alt(width=250) alt(width=250)

Usage

IMKit enables message recall by default. Users can long-press a successfully sent message in the conversation UI to open an action sheet and select "Recall." After recall, the message can be re-edited within a limited time.

tip
  • By default, only the sender can recall a message.
  • Only successfully sent and stored messages can be recalled.

Customization

Handling the "Re-edit" Button Tap Event

After recalling a message, the conversation UI displays RCRecallNotificationMessage, and the message cell shows a Re-edit button. Tapping this button triggers the callback below without invoking the didTapMessageCell callback.

Method Signature

- (void)didTapReedit:(RCMessageModel *)model;

Parameters

ParameterTypeDescription
modelRCMessageModelData model of the message cell

Adjusting the Maximum Recall Time

IMKit allows recalling messages within 120 seconds of sending by default. You can modify this limit via global configuration.

RCKitConfigCenter.message.maxRecallDuration = 120;

Setting the Re-edit Time Window

By default, IMKit permits re-editing within 300 seconds after recall, and only text messages support this feature. Adjust this limit via global configuration.

RCKitConfigCenter.message.reeditDuration = 300;

Additional Customization

IMKit SDK handles message recall and display logic by default without requiring additional API calls. If the default implementation doesn't meet your needs, use the relevant APIs in IMKit. For details, see Message Recall.

Disabling Recall

IMKit enables message recall by default. Disable it via global configuration.

RCKitConfigCenter.message.enableMessageRecall = NO;