SDKsiOS
Clear all messages
Clear all local and server-side messages for the current account with OpenIM iOS SDK.
Invoke deleteAllMsgFromLocalAndSvrWithOnSuccess:onFailure: on OIMManager to permanently clear all conversation history stored locally and on the server for the current account:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
onSuccess | OIMSuccessCallback | Yes | Success callback confirming message history was cleared across local and server storage. |
onFailure | OIMFailureCallback | Yes | Failure callback returning error code code and descriptive message msg. |
Code example
[[OIMManager manager] deleteAllMsgFromLocalAndSvrWithOnSuccess:^(NSString * _Nullable data) {
// Clear completed; reset local message caches and refresh conversation views
[self resetAllMessageSnapshots];
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
// Handle clearing failure
}];Return value
The onSuccess callback confirms that all local and server-side message records for the current account were deleted.
State changes after the call
- Irreversible account-level operation: This operation clears message records for the current logged-in account across both local SQLite storage and remote server storage. It does not delete copies stored on other conversation members' devices.
- Conversation summary synchronization: After clearing messages, update the in-memory cache and UI views. Conversation summaries and latest message previews will reflect these changes through conversation change events or subsequent conversation list queries. To clear local device storage only without touching server records, see Clear all local messages.
Was this page helpful?