AI Integration Quick Reference
AI Integration Quick Reference
OfflineConfig options
Build withOfflineConfig.Builder, or with the Swift initializer OfflineConfig(enabled:encryption:…), whose arguments all default to the values below. The resulting OfflineConfig is immutable. Byte caps and the TTL treat 0 or less as unlimited (that dimension’s eviction is disabled); the count caps are clamped and have no “unlimited”.
Attach the config at init via
AppSettings.AppSettingsBuilder.setOfflineConfig(_:) — see Enable Offline Support. Each value is readable on the built OfflineConfig (for example offlineConfig.maxConversations), and AppSettings.offlineConfig exposes the active config read-only.
Public methods on CometChat
On the returned
UploadFileRequest, getItems() lists each file’s UploadFileItemStatus, and retryAttachment(fileId:) retries one failed file. See Upload Files.
Listener registration
Listeners are held weakly — keep a strong reference — and each ID holds one listener, so use a distinct ID per listener.Listeners and callbacks
Two-phase fetch overloads
iOS expresses the two-phase read asonCached… / onServer… / onError closure overloads of the existing fetch methods. The only listener protocols on the read path are ConversationDetailsListener and MessageDetailsListener. With offline off the cached closure never fires.
Send, outbox, sync, cache, and media callbacks
All listener methods are optional (
@objc optional).
What the cache can answer
The cached phase answers a read only if every active filter is locally computable; one server-only filter returns an empty cached page (the server phase still answers in full). Enrichment flags never block the cached phase.Enums
The enums are available asCometChat.<Name> in Swift (for example CometChat.MessageStatus). In Objective-C they are named CometChat<Name> (for example CometChatMessageStatus).
Model fields
Error codes
CompareCometChatException.errorCode against these CometChatConstants.Errors constants.
A background download that fails reports
onMediaDownloadFailed with the error code string "ERROR_MEDIA_DOWNLOAD_FAILED", which is not a CometChatConstants.Errors constant.
Legacy overloads
The classic single-callback overloads are not deprecated on iOS. They are unchanged and never deliver a cached or pending result. The two-phase and pending-aware overloads are additive, and you choose between them by argument label. Only these are deprecated:
The entity-list requests (
UsersRequest, GroupsRequest, GroupMembersRequest, BannedGroupMembersRequest, BlockedUserRequest, ReactionsRequest, NotificationFeedRequest) follow the same pattern: keep fetchNext(onSuccess:onError:) or add the onCached… / onServer… overload listed above.