AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Platform | iOS UI Kit |
| Common Issues | Initialization, theming, real-time updates, permissions |
| Key Checks | SDK initialization, user login, CometChatUIKit.init() order |
| Permissions | Camera, microphone (Info.plist) |
| Debug | Check SDK connection status, verify dashboard settings |
CocoaPods Issues
| Issue | Solution |
|---|---|
| ”Could not find compatible versions” | Run pod install --repo-update to refresh spec repos |
| Pod version not found | Verify the version exists on CocoaPods |
| Repo clone failures | Clean repos with commands below, then retry |
| Build errors after pod install | Open .xcworkspace file, not .xcodeproj |
Clean and Retry
Reset CocoaPods Completely
If repo errors persist:Fallback to Swift Package Manager
If CocoaPods continues to fail, use SPM instead:- Remove Podfile and Pods folder
- Open your
.xcodeprojin Xcode - Go to File → Add Package Dependencies
- Add
https://github.com/cometchat/cometchat-uikit-ioswith version5.1.9 - Add
https://github.com/cometchat/chat-sdk-ioswith version4.1.0
Initialization Issues
| Issue | Solution |
|---|---|
| SDK not initialized | Call CometChat.init() before any UI Kit operations |
| User not logged in | Ensure CometChat.login() completes successfully before showing UI |
| UIKit not initialized | Call CometChatUIKit.init() after SDK init and before using components |
| Credentials invalid | Verify App ID, Auth Key, and Region in CometChat Dashboard |
Theming & Styling
| Issue | Solution |
|---|---|
| Colors not applying | Apply theme before CometChatUIKit.init() |
| Dark mode not working | Use UIColor { traitCollection in } for dynamic colors |
| Inconsistent colors | Set all related colors (text, background, border) together |
| Styles not applying | Apply global styles before CometChatUIKit.init() |
| Instance style overridden | Instance styles take precedence over global styles |
| Font not loading | Verify font name is correct and font is added to project |
Conversations
| Issue | Solution |
|---|---|
| Empty conversation list | Ensure user is logged in and has existing conversations |
| Conversations not updating | Check SDK connection and real-time listeners |
| Navigation not working | Verify navigationController is not nil; embed in UINavigationController |
| Custom views not appearing | Ensure custom view has proper constraints and non-zero frame |
| Typing indicator not showing | Verify disableTyping is not set to true |
Users
| Issue | Solution |
|---|---|
| Empty user list | Ensure SDK is initialized and user is logged in |
| Users not updating in real-time | Check SDK connection and presence listeners |
| Search not working | Verify hideSearch is not set to true |
| Status not showing | Check that hideUserStatus is not set to true |
| Custom views not appearing | Ensure custom view has proper constraints |
Groups
| Issue | Solution |
|---|---|
| Empty group list | Ensure SDK is initialized and user is logged in |
| Groups not updating in real-time | Check SDK connection and group listeners |
| Search not working | Verify hideSearch is not set to true |
| Group type icons not showing | Check that hideGroupType is not set to true |
| Custom views not appearing | Ensure custom view has proper constraints |
Group Members
| Issue | Solution |
|---|---|
| Empty member list | Ensure group object is valid and has members |
| Management options not showing | Check logged-in user’s permissions (must be admin/owner) |
| Search not working | Verify hideSearch is not set to true |
| Status not showing | Check that hideUserStatus is not set to true |
| Custom views not appearing | Ensure custom view has proper constraints |
Message Header
| Issue | Solution |
|---|---|
| Header not showing user info | Ensure user or group is set on the header |
| Status not updating | Check SDK connection and user presence listeners |
| Back button not working | Verify onBack callback is set and hideBackButton is false |
| Typing indicator not showing | Ensure typing events are enabled in SDK |
| Call buttons not appearing | Check that hideVideoCallButton and hideVoiceCallButton are false |
Message List
| Issue | Solution |
|---|---|
| Messages not loading | Ensure user/group is set and SDK is initialized |
| Real-time updates not working | Check SDK connection status and listeners |
| Reactions not showing | Verify reactions are enabled in dashboard |
| Thread replies not working | Ensure hideReplyInThreadOption is not set to true |
| Custom views not appearing | Ensure custom view has proper constraints and non-zero frame |
| Scroll position issues | Check scrollToBottomOnNewMessages setting |
Message Composer
| Issue | Solution |
|---|---|
| Send button not working | Ensure user or group is set on the composer |
| Attachments not showing | Check that attachment options are not hidden |
| Voice recording not working | Verify microphone permissions are granted in Info.plist |
| Mentions not working | Ensure disableMentions is not set to true |
| Typing indicators not sent | Check that disableTypingEvents is not set to true |
Calling
| Issue | Solution |
|---|---|
| Call buttons not showing | Verify CometChatCallsSDK is in Podfile and run pod install |
| ”Permission denied” error | Add camera/microphone permissions to Info.plist |
| Calls not connecting | Check network connection and CometChat credentials |
| No incoming call UI | Ensure CometChatCallsSDK is initialized before login |
| Audio not working | Check device is not on silent mode |
AI Features
| Issue | Solution |
|---|---|
| AI features not appearing | Enable them in CometChat Dashboard → AI |
| Conversation starters not showing | Only appear for new conversations with no messages |
| Smart replies not appearing | Ensure feature is enabled and messages exist |
| Summary not generating | Need sufficient messages in conversation |
| AI Assistant empty | Verify user has AI chat history |
| Only loading indicator shows | Set user or group property |
| Styling not applied | Apply style before presenting view |
| Callbacks not firing | Set callbacks before pushing to navigation |
| AI not responding | Verify AI features are enabled in dashboard |
| Streaming not working | Check network connectivity |
| Agent not detected | Verify user has isAgentic property set to true |
Events
| Issue | Solution |
|---|---|
| Events not firing | Verify listener is added before the action occurs |
| Duplicate events | Check you’re not adding the same listener multiple times |
| Memory leaks | Ensure removeListener is called in viewWillDisappear |
| UI not updating | Dispatch UI updates to main thread with DispatchQueue.main.async |
| Listener ID conflicts | Use unique, descriptive IDs for each listener |
Permissions (Info.plist)
Add these keys to yourInfo.plist for full functionality:
Debug Checklist
When troubleshooting issues, verify the following:-
SDK Initialization
CometChat.init()called with correct App ID and RegionCometChatUIKit.init()called after SDK init
-
User Authentication
- User is logged in via
CometChat.login() - Auth token is valid and not expired
- User is logged in via
-
Dashboard Settings
- Features are enabled (AI, Reactions, etc.)
- API keys have correct permissions
-
Network
- Device has internet connectivity
- WebSocket connection is established
-
Permissions
- Required permissions added to Info.plist
- User has granted permissions at runtime
Getting Help
Sample App
Complete implementation example
UIKit Source
CometChat UIKit iOS repository
Error Guide
Complete list of error codes
Support
Contact CometChat support