> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

> Fixes for common problems with the CometChat iOS UI Kit v6: set-up and login, imports, Swift 6 concurrency, components, calling, formatters and events.

> [accordion] AI Integration Quick Reference
>
> ```json theme={null}
> {
>   "products": ["CometChatSwiftUI", "CometChatUIKit"],
>   "first step": "CometChatLog.sink = CometChatOSLogSink(); CometChatLog.minimumLevel = .debug — then read the session, listener and data events in Console",
>   "common causes": ["region mismatch fails at login", "SDK callbacks passed from main-actor code trap under Swift 6", "importing both toolkits makes component names ambiguous", "calling needs initialize(…, enableCalling: true) and the Calls SDK", "screens you build must emit events"]
> }
> ```

Start by turning the Kit's log on. It reports sessions, listener registration, pages, states and
error codes — never message text, names or tokens:

```swift theme={null}
CometChatLog.sink = CometChatOSLogSink()   // Console.app, subsystem "com.cometchat.uikit"
CometChatLog.minimumLevel = .debug
```

## Installation and Imports

| Problem | Cause and fix |
| - | - |
| The package will not resolve with CocoaPods | v6 is **Swift Package Manager only**. Add `https://github.com/cometchat/cometchat-uikit-ios.git` from `6.0.0-beta.1`. |
| "Compiling for iOS 17.0, but module … has a minimum deployment target of iOS 18.0" | v6 requires iOS 18. Raise your deployment target. |
| `CometChatConversations` is ambiguous | Both toolkits declare it. Add **one** product — `CometChatSwiftUI` or `CometChatUIKit` — and import one per file. |
| `cannot find 'CometChatSession' in scope` | The file imports neither toolkit. `CometChatSession` lives in `CometChatCore`, which both toolkits re-export: add `import CometChatSwiftUI` or `import CometChatUIKit`. |
| `cannot find type 'User'` / `'BaseMessage'` | SDK types come from the Chat SDK: `import CometChatSDK`. |

## Initialization and Login

| Problem | Cause and fix |
| - | - |
| Login fails with an auth error although the credentials are right | `region` does not match the dashboard. A mismatch does not fail at `initialize`; it fails at login. |
| Login runs on every launch | The SDK keeps the session. Check `CometChatSession.loggedInUser` before calling `login`. |
| No online dots anywhere | `subscribePresenceForAllUsers: false` was passed to `initialize`. Leave it at the default, `true`. |
| An auth key in a production build | Use `CometChatSession.login(authToken:)` with a token your server creates. |

## Swift 6 Concurrency

| Problem | Cause and fix |
| - | - |
| "BUG IN CLIENT OF LIBDISPATCH: Block was expected to execute on queue \[com.apple.main-thread]" when an SDK call returns | You passed an SDK callback from main-actor code — a view, a view controller. Under Swift 6 that closure is main-actor isolated and the SDK calls it on its own queue. Make the call from a `nonisolated` function that resumes a continuation, as the [Block / Unblock User](https://www.cometchat.com/docs/ui-kit/ios/v6/guide-block-unblock-user.md) guide does. |
| "Sending … risks causing data races" with an SDK object | SDK classes are not `Sendable`. Pass ids and strings across the boundary, or wrap the object in `SDKBox` from `CometChatCore`. |
| A formatter's stored state will not initialise | `CometChatTextFormatter` is `@MainActor`; declare the conformance on the class itself so the class is main-actor isolated. |

## Components

| Problem | Cause and fix |
| - | - |
| A list loads once and never updates | Something removed the SDK's listeners or the socket. Do not reuse a store's listener id for two live stores; the SDK silently replaces the first. |
| The conversations search field does not filter | By design: it is a button that calls `onSearchClick`. Open `CometChatSearch` from it. |
| Tapping a conversation does nothing | The Kit has no chat screen. Handle `onItemClick` (SwiftUI) / the delegate or `set(onItemClick:)` (UIKit) and open your own. |
| **Message Privately** does nothing | Handle `onMessagePrivately` / `set(onMessagePrivately:)`, or hide the option. |
| A thread reply lands in the main chat | Give the composer the parent's id **and** the chat's user or group — `parentMessageId:` / `set(parentMessageId:)`. |
| The composer still shows after blocking someone | The composer does not hide itself. Hide it while `user.blockedByMe` — see [Block / Unblock User](https://www.cometchat.com/docs/ui-kit/ios/v6/guide-block-unblock-user.md). |
| A password group opens without joining | A password group you have not joined comes to `onItemClick` unjoined. Ask for the password and call `join(_:password:)` on the list's store. |
| No Pin or Save in the message menu | The feature is off for the app: `CometChatSession.isPinMessageEnabled()` / `isSaveMessageEnabled()` are `false`. Turn it on in the dashboard. |
| Copy and Share put out `<@uid:…>` | They run only the formatters you pass. Give the message list `textFormatters`. |
| My view slot is ignored in SwiftUI | An initialiser argument wins over a modifier, and a modifier over the theme. Check you did not pass both. |
| A pushed SwiftUI list shows two navigation bars | The list embeds its own `NavigationStack`. Pass `embedsNavigationStack: false` inside your own stack. |
| A custom UIKit cell shows another row's content | Clear your subviews in `prepareForReuse()`. |

## Calling

| Problem | Cause and fix |
| - | - |
| No call buttons in the SwiftUI header | `hideVoiceCallButton` and `hideVideoCallButton` default to `true` there. Pass `false`. |
| Call buttons never appear in either toolkit | Calling is off by default. Use `CometChatSession.initialize(appID:region:enableCalling: true)`; the Calls SDK must be linked too — check `CallingAvailability.isCallingEnabled`. |
| Calling stays off after `initialize` succeeds | A Calls SDK set-up failure is logged and leaves calling off. Turn the log on and look for the session category. |

## Text Formatters

| Problem | Cause and fix |
| - | - |
| My formatter changes nothing in the bubbles | Message bubbles do not run custom formatters. Formatters change Conversations' last message, quoted replies, pinned and saved messages, search results, and Copy and Share. |
| Mentions disappeared from the SwiftUI composer | `textFormatters` replaces the list; include a `CometChatMentionsFormatter`. `disableMentions: true` removes every formatter. |
| My formatter is used twice in UIKit | `set(textFormatter:)` appends. Call it once. |
| A custom tracking character is ignored for mentions | Both toolkits always start a mention with `@`. |

## Events

| Problem | Cause and fix |
| - | - |
| Lists go stale after an action on my own screen | The Kit cannot see your screens. Emit the event — see [Events](https://www.cometchat.com/docs/ui-kit/ios/v6/events.md). |
| A SwiftUI event modifier stops firing | It listens only while its view is on screen. Listen with `CometChatEvents.<family>Events` in a long-lived object instead. |
| A UIKit listener stops hearing | Listeners are held weakly. Keep a strong reference to the listener; a second `addListener` with the same id replaces the first. |
| Other people's messages do not reach my bus listener | The Kit's bus carries this user's actions. Listen to the SDK for other people's messages, typing and receipts. |

## Next Steps

> [card] [Methods](https://www.cometchat.com/docs/ui-kit/ios/v6/methods.md)
>
> Set-up, login and logging

> [card] [Events](https://www.cometchat.com/docs/ui-kit/ios/v6/events.md)
>
> What to emit and when

> [card] [Upgrading from v5](https://www.cometchat.com/docs/ui-kit/ios/v6/migrating-from-v5.md)
>
> Behaviour that changed

> [card] [Support](https://help.cometchat.com/hc/en-us/requests/new)
>
> Open a support request


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.