Skip to main content
Offline support is off by default. You turn it on once, at initialization, by attaching an OfflineConfig to your AppSettings. Until you do, the SDK behaves exactly as before. This page covers the minimal setup; for every tunable option see the Configuration & API Reference.
1

Requirements

Offline support requires CometChat iOS SDK 4.2.0 or later. Update the dependency:
If you are new to the SDK, complete the standard setup first; the steps below only add offline configuration to your existing init.
2

Build an OfflineConfig

Create an OfflineConfig and enable it. Every other field has a default, so set only what you need. In Swift you can use the initializer with default arguments. The Builder works from both Swift and Objective-C.
3

Attach it to AppSettings

Pass the config to AppSettingsBuilder.setOfflineConfig(_:). Without it, AppSettings keeps OfflineConfig.default, which has offline switched off.
4

Initialize the SDK

Pass the settings to CometChat.init as you do today. No other call changes.
5

Verify it is active

Call CometChat.isOfflineEnabled(). It returns true only while offline support is actually active for the logged-in user. It is false before anyone logs in (even when you enabled it in AppSettings), after logout or session expiry, and when the encrypted cache cannot open. Read it at the moment of each decision and keep no copy of the result.
It is also false while the cache cannot run encrypted on this device and you chose .onlineOnly (see Encrypt the Cache). It is already true by the time any onLoginSuccess observer runs.

Next steps

Offline support is now active for the logged-in user. Continue with Show Cached Data to adopt the two-phase read overloads, and Send While Offline for the durable outbox. Tune caps, media, and encryption from the Configuration & API Reference.