@cometchat/skills 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -17
  3. package/bin/install.js +389 -43
  4. package/package.json +19 -9
  5. package/skills/cometchat/SKILL.md +1066 -265
  6. package/skills/cometchat-android-v5/SKILL.md +120 -0
  7. package/skills/cometchat-android-v5-components/SKILL.md +430 -0
  8. package/skills/cometchat-android-v5-core/SKILL.md +468 -0
  9. package/skills/cometchat-android-v5-customization/SKILL.md +305 -0
  10. package/skills/cometchat-android-v5-extensions/SKILL.md +124 -0
  11. package/skills/cometchat-android-v5-features/SKILL.md +130 -0
  12. package/skills/cometchat-android-v5-placement/SKILL.md +276 -0
  13. package/skills/cometchat-android-v5-production/SKILL.md +94 -0
  14. package/skills/cometchat-android-v5-push/SKILL.md +620 -0
  15. package/skills/cometchat-android-v5-testing/SKILL.md +187 -0
  16. package/skills/cometchat-android-v5-theming/SKILL.md +166 -0
  17. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +73 -0
  18. package/skills/cometchat-android-v6/SKILL.md +107 -0
  19. package/skills/cometchat-android-v6-builder-settings/SKILL.md +145 -0
  20. package/skills/cometchat-android-v6-compose-components/SKILL.md +202 -0
  21. package/skills/cometchat-android-v6-compose-customization/SKILL.md +280 -0
  22. package/skills/cometchat-android-v6-compose-placement/SKILL.md +213 -0
  23. package/skills/cometchat-android-v6-compose-theming/SKILL.md +224 -0
  24. package/skills/cometchat-android-v6-core/SKILL.md +354 -0
  25. package/skills/cometchat-android-v6-events/SKILL.md +212 -0
  26. package/skills/cometchat-android-v6-extensions/SKILL.md +191 -0
  27. package/skills/cometchat-android-v6-features/SKILL.md +130 -0
  28. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +197 -0
  29. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +268 -0
  30. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +248 -0
  31. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +202 -0
  32. package/skills/cometchat-android-v6-production/SKILL.md +187 -0
  33. package/skills/cometchat-android-v6-push/SKILL.md +274 -0
  34. package/skills/cometchat-android-v6-testing/SKILL.md +279 -0
  35. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +249 -0
  36. package/skills/cometchat-angular-components/SKILL.md +706 -0
  37. package/skills/cometchat-angular-core/SKILL.md +444 -0
  38. package/skills/cometchat-angular-customization/SKILL.md +424 -0
  39. package/skills/cometchat-angular-features/SKILL.md +447 -0
  40. package/skills/cometchat-angular-patterns/SKILL.md +447 -0
  41. package/skills/cometchat-angular-placement/SKILL.md +685 -0
  42. package/skills/cometchat-angular-production/SKILL.md +415 -0
  43. package/skills/cometchat-angular-theming/SKILL.md +365 -0
  44. package/skills/cometchat-angular-troubleshooting/SKILL.md +329 -0
  45. package/skills/cometchat-astro-patterns/SKILL.md +3 -3
  46. package/skills/cometchat-components/SKILL.md +11 -0
  47. package/skills/cometchat-core/SKILL.md +11 -6
  48. package/skills/cometchat-customization/references/component-catalog.md +1 -1
  49. package/skills/cometchat-features/SKILL.md +176 -108
  50. package/skills/cometchat-flutter-v5/SKILL.md +167 -0
  51. package/skills/cometchat-flutter-v5-calls/SKILL.md +192 -0
  52. package/skills/cometchat-flutter-v5-conversations/SKILL.md +117 -0
  53. package/skills/cometchat-flutter-v5-core/SKILL.md +221 -0
  54. package/skills/cometchat-flutter-v5-customization/SKILL.md +227 -0
  55. package/skills/cometchat-flutter-v5-events/SKILL.md +155 -0
  56. package/skills/cometchat-flutter-v5-messages/SKILL.md +258 -0
  57. package/skills/cometchat-flutter-v5-production/SKILL.md +207 -0
  58. package/skills/cometchat-flutter-v5-push/SKILL.md +284 -0
  59. package/skills/cometchat-flutter-v5-theming/SKILL.md +160 -0
  60. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +129 -0
  61. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +151 -0
  62. package/skills/cometchat-flutter-v6/SKILL.md +445 -0
  63. package/skills/cometchat-flutter-v6-calls/SKILL.md +333 -0
  64. package/skills/cometchat-flutter-v6-components/SKILL.md +365 -0
  65. package/skills/cometchat-flutter-v6-conversations/SKILL.md +210 -0
  66. package/skills/cometchat-flutter-v6-core/SKILL.md +305 -0
  67. package/skills/cometchat-flutter-v6-customization/SKILL.md +666 -0
  68. package/skills/cometchat-flutter-v6-events/SKILL.md +216 -0
  69. package/skills/cometchat-flutter-v6-features/SKILL.md +406 -0
  70. package/skills/cometchat-flutter-v6-messages/SKILL.md +333 -0
  71. package/skills/cometchat-flutter-v6-migration/SKILL.md +381 -0
  72. package/skills/cometchat-flutter-v6-placement/SKILL.md +398 -0
  73. package/skills/cometchat-flutter-v6-production/SKILL.md +632 -0
  74. package/skills/cometchat-flutter-v6-theming/SKILL.md +260 -0
  75. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +726 -0
  76. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +216 -0
  77. package/skills/cometchat-ios/SKILL.md +323 -0
  78. package/skills/cometchat-ios-components/SKILL.md +651 -0
  79. package/skills/cometchat-ios-core/SKILL.md +822 -0
  80. package/skills/cometchat-ios-customization/SKILL.md +825 -0
  81. package/skills/cometchat-ios-features/SKILL.md +725 -0
  82. package/skills/cometchat-ios-placement/SKILL.md +750 -0
  83. package/skills/cometchat-ios-production/SKILL.md +730 -0
  84. package/skills/cometchat-ios-push/SKILL.md +582 -0
  85. package/skills/cometchat-ios-theming/SKILL.md +631 -0
  86. package/skills/cometchat-ios-troubleshooting/SKILL.md +983 -0
  87. package/skills/cometchat-native-bare-patterns/SKILL.md +470 -0
  88. package/skills/cometchat-native-components/SKILL.md +594 -0
  89. package/skills/cometchat-native-core/SKILL.md +407 -0
  90. package/skills/cometchat-native-customization/SKILL.md +594 -0
  91. package/skills/cometchat-native-expo-patterns/SKILL.md +485 -0
  92. package/skills/cometchat-native-features/SKILL.md +608 -0
  93. package/skills/cometchat-native-placement/SKILL.md +500 -0
  94. package/skills/cometchat-native-production/SKILL.md +694 -0
  95. package/skills/cometchat-native-push/SKILL.md +593 -0
  96. package/skills/cometchat-native-testing/SKILL.md +583 -0
  97. package/skills/cometchat-native-theming/SKILL.md +656 -0
  98. package/skills/cometchat-native-troubleshooting/SKILL.md +433 -0
  99. package/skills/cometchat-nextjs-patterns/SKILL.md +5 -5
  100. package/skills/cometchat-production/SKILL.md +60 -0
  101. package/skills/cometchat-react-router-patterns/SKILL.md +23 -21
@@ -0,0 +1,983 @@
1
+ ---
2
+ name: cometchat-ios-troubleshooting
3
+ description: "Diagnose and fix common CometChat iOS integration issues — build errors, runtime errors, and debugging techniques."
4
+ license: "MIT"
5
+ compatibility: "CometChatUIKitSwift ^5; iOS 13+"
6
+ allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
7
+ metadata:
8
+ author: "CometChat"
9
+ version: "3.0.0"
10
+ tags: "chat cometchat ios troubleshooting debugging errors fixes"
11
+ ---
12
+
13
+ ## Purpose
14
+
15
+ This skill helps diagnose and fix common issues when integrating CometChat iOS UI Kit. It covers build errors, runtime errors, and debugging techniques.
16
+
17
+ ---
18
+
19
+ ## 1. Build Errors
20
+
21
+ ### "No such module 'CometChatUIKitSwift'"
22
+
23
+ **Cause:** SDK not installed or not linked properly.
24
+
25
+ **Solutions:**
26
+
27
+ **CocoaPods:**
28
+ ```bash
29
+ # Clean and reinstall
30
+ cd /path/to/your/project
31
+ rm -rf Pods Podfile.lock
32
+ pod install --repo-update
33
+
34
+ # Open workspace (not project!)
35
+ open YourApp.xcworkspace
36
+ ```
37
+
38
+ **Swift Package Manager:**
39
+ 1. In Xcode, go to File → Packages → Reset Package Caches
40
+ 2. File → Packages → Resolve Package Versions
41
+ 3. Clean build folder: Cmd + Shift + K
42
+ 4. Build again
43
+
44
+ **Check Podfile:**
45
+ ```ruby
46
+ platform :ios, '13.0'
47
+ use_frameworks!
48
+
49
+ target 'YourApp' do
50
+ pod 'CometChatUIKitSwift', '~> 5.1'
51
+ end
52
+ ```
53
+
54
+ ---
55
+
56
+ ### "No such module 'CometChatSDK'"
57
+
58
+ **Cause:** Core SDK not installed alongside UI Kit.
59
+
60
+ **Solution:** The UI Kit should include the SDK automatically. If not:
61
+
62
+ ```ruby
63
+ # Podfile
64
+ pod 'CometChatUIKitSwift', '~> 5.1'
65
+ pod 'CometChatSDK', '~> 4.0' # Add explicitly if needed
66
+ ```
67
+
68
+ ---
69
+
70
+ ### "No such module 'CometChatCallsSDK'"
71
+
72
+ **Cause:** Calls SDK not installed but code references it.
73
+
74
+ **Solutions:**
75
+
76
+ 1. **If you need calls:**
77
+ ```ruby
78
+ # Podfile
79
+ pod 'CometChatCallsSDK', '~> 4.0'
80
+ ```
81
+
82
+ 2. **If you don't need calls:**
83
+ Wrap call-related code in conditional compilation:
84
+ ```swift
85
+ #if canImport(CometChatCallsSDK)
86
+ import CometChatCallsSDK
87
+ // Call-related code here
88
+ #endif
89
+ ```
90
+
91
+ ---
92
+
93
+ ### "Value of type 'CometChatException' has no member 'localizedDescription'"
94
+
95
+ **Cause:** Using wrong property for error description.
96
+
97
+ **Solution:** Use `errorDescription` instead of `localizedDescription`:
98
+
99
+ ```swift
100
+ case .onError(let error):
101
+ print(error.errorDescription)
102
+ print(error.errorCode)
103
+ ```
104
+
105
+ `CometChatException` has:
106
+ - `errorDescription` — human-readable error message
107
+ - `errorCode` — error code string
108
+ - `details` — optional dictionary with additional info
109
+
110
+ ---
111
+
112
+ ### "'CometChatException' is not convertible to 'any Error'"
113
+
114
+ **Cause:** Trying to use `CometChatException` with Swift's `Result<T, Error>` type.
115
+
116
+ **Solution:** `CometChatException` does NOT conform to Swift's `Error` protocol. Don't use `Result<T, Error>` with CometChat callbacks. Instead, use direct callbacks:
117
+
118
+ ```swift
119
+ // ❌ WRONG - Don't use Result<T, Error>
120
+ func login(completion: @escaping (Result<User, Error>) -> Void) {
121
+ CometChatUIKit.login(uid: uid) { result in
122
+ switch result {
123
+ case .success(let user):
124
+ completion(.success(user))
125
+ case .onError(let error):
126
+ completion(.failure(error)) // ERROR: CometChatException is not Error
127
+ }
128
+ }
129
+ }
130
+
131
+ // ✅ CORRECT - Use CometChatException directly
132
+ func login(completion: @escaping (User?, CometChatException?) -> Void) {
133
+ CometChatUIKit.login(uid: uid) { result in
134
+ switch result {
135
+ case .success(let user):
136
+ completion(user, nil)
137
+ case .onError(let error):
138
+ completion(nil, error)
139
+ @unknown default:
140
+ completion(nil, nil)
141
+ }
142
+ }
143
+ }
144
+ ```
145
+
146
+ ---
147
+
148
+ ### "Cannot find 'CometChatConversationsWithMessages' in scope" or "Cannot find 'CometChatMessages' in scope"
149
+
150
+ **Cause:** Neither class exists in the kit. They look like "pre-built composite UIViewControllers" but are NOT exported from `CometChatUIKitSwift`. Older docs and AI-generated guides sometimes claim they exist.
151
+
152
+ **Solution:** Compose your own `MessagesVC` from the real building blocks (`CometChatMessageHeader` + `CometChatMessageList` + `CometChatMessageComposer`). The pattern is the same one the kit's sample app uses (`SampleApp/View Controllers/CometChat Components/MessagesVC.swift`).
153
+
154
+ ```swift
155
+ import CometChatUIKitSwift
156
+ import CometChatSDK
157
+
158
+ let conversations = CometChatConversations()
159
+ let navController = UINavigationController(rootViewController: conversations)
160
+
161
+ conversations.set(onItemClick: { [weak navController] conversation, _ in
162
+ let messagesVC = MessagesVC() // your own VC composing CometChatMessageHeader + List + Composer
163
+ if let group = conversation.conversationWith as? Group {
164
+ messagesVC.set(group: group)
165
+ } else if let user = conversation.conversationWith as? User {
166
+ messagesVC.set(user: user)
167
+ }
168
+ navController?.pushViewController(messagesVC, animated: true)
169
+ })
170
+ ```
171
+
172
+ See `cometchat-ios-components` § 13 ("Custom MessagesVC Implementation") for the full `MessagesVC` source.
173
+
174
+ ---
175
+
176
+ ### "Cannot find 'CometChatCallLogs' in scope"
177
+
178
+ **Cause:** `CometChatCallLogs` requires `CometChatCallsSDK` which is not installed.
179
+
180
+ **Solutions:**
181
+
182
+ 1. **Install the Calls SDK:**
183
+ ```ruby
184
+ # Podfile
185
+ pod 'CometChatCallsSDK', '~> 4.0'
186
+ ```
187
+
188
+ 2. **Or wrap in conditional compilation:**
189
+ ```swift
190
+ #if canImport(CometChatCallsSDK)
191
+ let callLogs = CometChatCallLogs()
192
+ #else
193
+ // Show placeholder or hide calls tab
194
+ #endif
195
+ ```
196
+
197
+ ---
198
+
199
+ ### "Duplicate symbols" or "Multiple commands produce"
200
+
201
+ **Cause:** Conflicting dependencies or duplicate frameworks.
202
+
203
+ **Solutions:**
204
+
205
+ 1. **Clean derived data:**
206
+ ```bash
207
+ rm -rf ~/Library/Developer/Xcode/DerivedData
208
+ ```
209
+
210
+ 2. **Check for duplicate pods:**
211
+ ```bash
212
+ pod deintegrate
213
+ pod install
214
+ ```
215
+
216
+ 3. **Check Build Phases:**
217
+ - Go to Target → Build Phases → Link Binary With Libraries
218
+ - Remove any duplicate frameworks
219
+
220
+ ---
221
+
222
+ ### "The iOS deployment target is set to X.X, but the range of supported deployment target versions is Y.Y to Z.Z"
223
+
224
+ **Cause:** Minimum iOS version mismatch.
225
+
226
+ **Solution:**
227
+
228
+ 1. Update your project's deployment target to iOS 13.0 or higher
229
+ 2. Update Podfile:
230
+ ```ruby
231
+ platform :ios, '13.0'
232
+ ```
233
+
234
+ 3. Run:
235
+ ```bash
236
+ pod install
237
+ ```
238
+
239
+ ---
240
+
241
+ ### "Sandbox: rsync.samba denied"
242
+
243
+ **Cause:** Xcode sandbox permission issue (common in Xcode 15+).
244
+
245
+ **Solution:**
246
+
247
+ 1. Disable User Script Sandboxing in Build Settings:
248
+ - Select your app target
249
+ - Go to Build Settings
250
+ - Search for "User Script Sandboxing"
251
+ - Set **ENABLE_USER_SCRIPT_SANDBOXING** to **No**
252
+
253
+ 2. Or add to your `Podfile`:
254
+ ```ruby
255
+ post_install do |installer|
256
+ installer.pods_project.targets.each do |target|
257
+ target.build_configurations.each do |config|
258
+ config.build_settings['ENABLE_USER_SCRIPT_SANDBOXING'] = 'NO'
259
+ end
260
+ end
261
+ end
262
+ ```
263
+
264
+ 3. Then run:
265
+ ```bash
266
+ pod install
267
+ ```
268
+
269
+ 4. Clean and rebuild:
270
+ ```bash
271
+ rm -rf ~/Library/Developer/Xcode/DerivedData
272
+ ```
273
+
274
+ ---
275
+
276
+ ### "Framework not found" during archive
277
+
278
+ **Cause:** Framework search paths issue.
279
+
280
+ **Solution:**
281
+
282
+ 1. Go to Target → Build Settings
283
+ 2. Search for "Framework Search Paths"
284
+ 3. Add: `$(inherited)` and `$(PROJECT_DIR)/Pods`
285
+ 4. Set "Build Active Architecture Only" to No for Release
286
+
287
+ ---
288
+
289
+ ## 2. Runtime Errors
290
+
291
+ ### "CometChat is not initialized"
292
+
293
+ **Cause:** Trying to use CometChat before initialization completes.
294
+
295
+ **Solution:**
296
+
297
+ ```swift
298
+ // ❌ Wrong - using before init completes
299
+ CometChatUIKit(uiKitSettings: settings) { _ in }
300
+ let conversations = CometChatConversations() // Too early!
301
+
302
+ // ✅ Correct - wait for completion
303
+ CometChatUIKit(uiKitSettings: settings) { result in
304
+ switch result {
305
+ case .success:
306
+ DispatchQueue.main.async {
307
+ let conversations = CometChatConversations()
308
+ // Now safe to use
309
+ }
310
+ case .failure(let error):
311
+ print("Init failed: \(error)")
312
+ }
313
+ }
314
+ ```
315
+
316
+ ---
317
+
318
+ ### "Invalid App ID" or "App not found"
319
+
320
+ **Cause:** Wrong App ID or region.
321
+
322
+ **Solutions:**
323
+
324
+ 1. Verify App ID in CometChat Dashboard
325
+ 2. Check region matches (us, eu, or in)
326
+ 3. Ensure no extra spaces in credentials
327
+
328
+ ```swift
329
+ let uiKitSettings = UIKitSettings()
330
+ .set(appID: "YOUR_APP_ID") // No spaces!
331
+ .set(region: "us") // Lowercase
332
+ .build()
333
+ ```
334
+
335
+ ---
336
+
337
+ ### "Invalid Auth Key"
338
+
339
+ **Cause:** Wrong or expired Auth Key.
340
+
341
+ **Solutions:**
342
+
343
+ 1. Get fresh Auth Key from Dashboard → API & Auth Keys
344
+ 2. Use the correct key type (Auth Key, not REST API Key)
345
+ 3. Check for copy/paste errors
346
+
347
+ ---
348
+
349
+ ### "User not found" or "UID not found"
350
+
351
+ **Cause:** Trying to login with a UID that doesn't exist.
352
+
353
+ **Solutions:**
354
+
355
+ 1. **Use pre-created test users:**
356
+ - `cometchat-uid-1` through `cometchat-uid-5`
357
+
358
+ 2. **Create user first:**
359
+ ```swift
360
+ let user = User(uid: "new-user-123", name: "John Doe")
361
+ CometChatUIKit.create(user: user) { result in
362
+ switch result {
363
+ case .success(let user):
364
+ // Now login
365
+ CometChatUIKit.login(uid: user.uid ?? "") { _ in }
366
+ case .onError(let error):
367
+ print("Create failed: \(error)")
368
+ }
369
+ }
370
+ ```
371
+
372
+ ---
373
+
374
+ ### "Already logged in"
375
+
376
+ **Cause:** Calling login when user is already logged in.
377
+
378
+ **Solution:**
379
+
380
+ ```swift
381
+ // Check for existing session first
382
+ if let currentUser = CometChatUIKit.getLoggedInUser() {
383
+ print("Already logged in as: \(currentUser.name ?? "")")
384
+ // Proceed to chat UI
385
+ } else {
386
+ // Login
387
+ CometChatUIKit.login(uid: "user-123") { _ in }
388
+ }
389
+ ```
390
+
391
+ ---
392
+
393
+ ### Blank/Empty Conversation List
394
+
395
+ **Cause:** No conversations exist for the logged-in user.
396
+
397
+ **Solutions:**
398
+
399
+ 1. **Send a test message:**
400
+ - Go to CometChat Dashboard → Users
401
+ - Select another user
402
+ - Send a message to your logged-in user
403
+
404
+ 2. **Check user is logged in:**
405
+ ```swift
406
+ if let user = CometChatUIKit.getLoggedInUser() {
407
+ print("Logged in as: \(user.uid ?? "")")
408
+ } else {
409
+ print("Not logged in!")
410
+ }
411
+ ```
412
+
413
+ 3. **Check for errors:**
414
+ ```swift
415
+ let conversations = CometChatConversations()
416
+ conversations.onError = { error in
417
+ print("Error loading conversations: \(error.errorDescription ?? "")")
418
+ }
419
+ conversations.onEmpty = {
420
+ print("No conversations found")
421
+ }
422
+ ```
423
+
424
+ ---
425
+
426
+ ### Messages Not Sending
427
+
428
+ **Cause:** Various issues with message sending.
429
+
430
+ **Solutions:**
431
+
432
+ 1. **Check user/group is set:**
433
+ ```swift
434
+ let composer = CometChatMessageComposer()
435
+ composer.set(user: user) // Must be set!
436
+ ```
437
+
438
+ 2. **Check for errors:**
439
+ ```swift
440
+ composer.onError = { error in
441
+ print("Composer error: \(error.errorDescription ?? "")")
442
+ }
443
+ ```
444
+
445
+ 3. **Verify network connection:**
446
+ ```swift
447
+ import Network
448
+
449
+ let monitor = NWPathMonitor()
450
+ monitor.pathUpdateHandler = { path in
451
+ if path.status == .satisfied {
452
+ print("Connected")
453
+ } else {
454
+ print("No connection")
455
+ }
456
+ }
457
+ monitor.start(queue: DispatchQueue.global())
458
+ ```
459
+
460
+ ---
461
+
462
+ ### Push Notifications Not Working
463
+
464
+ **Cause:** Multiple possible issues.
465
+
466
+ **Checklist:**
467
+
468
+ 1. **Physical device?** Push doesn't work on simulator
469
+
470
+ 2. **Permissions granted?**
471
+ ```swift
472
+ UNUserNotificationCenter.current().getNotificationSettings { settings in
473
+ print("Authorization status: \(settings.authorizationStatus.rawValue)")
474
+ }
475
+ ```
476
+
477
+ 3. **Token registered?**
478
+ ```swift
479
+ func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
480
+ let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
481
+ print("APNs Token: \(token)")
482
+
483
+ // Register with CometChat
484
+ CometChat.registerTokenForPushNotification(token: token, settings: ["voip": false]) { success in
485
+ print("Token registered: \(success)")
486
+ } onError: { error in
487
+ print("Token registration failed: \(error?.errorDescription ?? "")")
488
+ }
489
+ }
490
+ ```
491
+
492
+ 4. **Certificate uploaded?** Check Dashboard → Notifications → Push Notifications
493
+
494
+ 5. **Correct environment?** Development vs Production certificate must match
495
+
496
+ ---
497
+
498
+ ### Calls Not Working
499
+
500
+ **Cause:** Missing SDK or permissions.
501
+
502
+ **Checklist:**
503
+
504
+ 1. **CometChatCallsSDK installed?**
505
+ ```ruby
506
+ pod 'CometChatCallsSDK', '~> 4.0'
507
+ ```
508
+
509
+ 2. **Permissions in Info.plist?**
510
+ ```xml
511
+ <key>NSCameraUsageDescription</key>
512
+ <string>Camera access for video calls</string>
513
+ <key>NSMicrophoneUsageDescription</key>
514
+ <string>Microphone access for calls</string>
515
+ ```
516
+
517
+ 3. **Background modes enabled?**
518
+ - Audio, AirPlay, and Picture in Picture
519
+ - Voice over IP
520
+
521
+ 4. **Testing on real device?** Calls don't work on simulator
522
+
523
+ ---
524
+
525
+ ### Memory Warnings / Crashes
526
+
527
+ **Cause:** Memory leaks or retain cycles.
528
+
529
+ **Solutions:**
530
+
531
+ 1. **Use weak references in closures:**
532
+ ```swift
533
+ conversations.onItemClick = { [weak self] conversation, _ in
534
+ self?.openMessages(for: conversation)
535
+ }
536
+ ```
537
+
538
+ 2. **Remove listeners when done:**
539
+ ```swift
540
+ override func viewWillDisappear(_ animated: Bool) {
541
+ super.viewWillDisappear(animated)
542
+ CometChatMessageEvents.removeListener("my-listener")
543
+ }
544
+ ```
545
+
546
+ 3. **Profile with Instruments:**
547
+ - Product → Profile → Leaks
548
+ - Look for CometChat-related leaks
549
+
550
+ ---
551
+
552
+ ### UI Not Updating
553
+
554
+ **Cause:** Updates happening on background thread.
555
+
556
+ **Solution:**
557
+
558
+ ```swift
559
+ // Always update UI on main thread
560
+ CometChatUIKit.login(uid: "user-123") { result in
561
+ DispatchQueue.main.async {
562
+ switch result {
563
+ case .success:
564
+ self.showConversations()
565
+ case .onError(let error):
566
+ self.showError(error)
567
+ }
568
+ }
569
+ }
570
+ ```
571
+
572
+ ---
573
+
574
+ ## 3. Debugging Techniques
575
+
576
+ ### Enable CometChat Logging
577
+
578
+ ```swift
579
+ // Add before initialization
580
+ CometChat.setLogLevel(.debug)
581
+ ```
582
+
583
+ ### Check Connection Status
584
+
585
+ ```swift
586
+ CometChat.addConnectionListener("debug-listener", self)
587
+
588
+ extension YourClass: CometChatConnectionDelegate {
589
+ func connected() {
590
+ print("✅ CometChat connected")
591
+ }
592
+
593
+ func connecting() {
594
+ print("🔄 CometChat connecting...")
595
+ }
596
+
597
+ func disconnected() {
598
+ print("❌ CometChat disconnected")
599
+ }
600
+ }
601
+ ```
602
+
603
+ ### Monitor Message Events
604
+
605
+ ```swift
606
+ class DebugMessageListener: CometChatMessageDelegate {
607
+
608
+ func onTextMessageReceived(textMessage: TextMessage) {
609
+ print("📩 Text message received: \(textMessage.text ?? "")")
610
+ }
611
+
612
+ func onMediaMessageReceived(mediaMessage: MediaMessage) {
613
+ print("📎 Media message received: \(mediaMessage.messageType)")
614
+ }
615
+
616
+ func onMessageDeleted(message: BaseMessage) {
617
+ print("🗑 Message deleted: \(message.id)")
618
+ }
619
+ }
620
+
621
+ CometChat.addMessageListener("debug-messages", DebugMessageListener())
622
+ ```
623
+
624
+ ### Network Debugging
625
+
626
+ Use Charles Proxy or Proxyman to inspect CometChat API calls:
627
+
628
+ 1. Install Charles Proxy
629
+ 2. Enable SSL Proxying for `*.cometchat.io`
630
+ 3. Install Charles certificate on device/simulator
631
+ 4. Monitor requests and responses
632
+
633
+ ### Xcode Debugging
634
+
635
+ **Breakpoints:**
636
+ - Set breakpoints in CometChat callbacks
637
+ - Use symbolic breakpoints for CometChat methods
638
+
639
+ **Console:**
640
+ ```swift
641
+ // Print current state
642
+ print("User: \(CometChatUIKit.getLoggedInUser()?.uid ?? "none")")
643
+ print("Initialized: \(CometChatManager.shared.isInitialized)")
644
+ ```
645
+
646
+ ---
647
+
648
+ ## 4. Common Error Codes
649
+
650
+ | Code | Description | Solution |
651
+ |---|---|---|
652
+ | `ERR_UID_NOT_FOUND` | User doesn't exist | Create user first |
653
+ | `ERR_ALREADY_LOGGED_IN` | User already logged in | Check session before login |
654
+ | `ERR_NOT_LOGGED_IN` | No active session | Login first |
655
+ | `AUTH_ERR_AUTH_TOKEN_NOT_FOUND` | Invalid auth token | Generate new token |
656
+ | `ERR_INVALID_APP_ID` | Wrong App ID | Verify in dashboard |
657
+ | `ERR_INVALID_API_KEY` | Wrong API/Auth Key | Get correct key from dashboard |
658
+ | `ERR_BLOCKED_BY_EXTENSION` | Blocked by extension | Check extension settings |
659
+ | `ERR_RATE_LIMIT_EXCEEDED` | Too many requests | Implement rate limiting |
660
+ | `ERR_WEBSOCKET_CONNECTION_FAILED` | Connection failed | Check network, retry |
661
+
662
+ ---
663
+
664
+ ## 5. Performance Issues
665
+
666
+ ### Slow Conversation Loading
667
+
668
+ **Solutions:**
669
+
670
+ 1. **Limit initial fetch:**
671
+ ```swift
672
+ let conversations = CometChatConversations()
673
+ conversations.set(conversationsRequestBuilder: ConversationsRequest.ConversationsRequestBuilder()
674
+ .set(limit: 20) // Reduce initial load
675
+ )
676
+ ```
677
+
678
+ 2. **Enable pagination:**
679
+ Conversations automatically paginate. Ensure you're not fetching all at once.
680
+
681
+ ### Slow Message Loading
682
+
683
+ **Solutions:**
684
+
685
+ 1. **Limit message fetch:**
686
+ ```swift
687
+ let messageList = CometChatMessageList()
688
+ messageList.set(messagesRequestBuilder: MessagesRequest.MessageRequestBuilder()
689
+ .set(uid: user.uid ?? "")
690
+ .set(limit: 30) // Reduce initial load
691
+ )
692
+ ```
693
+
694
+ 2. **Hide unnecessary features:**
695
+ ```swift
696
+ messageList.hideReceipts = true // If not needed
697
+ messageList.hideAvatar = true // If not needed
698
+ ```
699
+
700
+ ### High Memory Usage
701
+
702
+ **Solutions:**
703
+
704
+ 1. **Release unused view controllers:**
705
+ ```swift
706
+ // Don't keep strong references to dismissed VCs
707
+ ```
708
+
709
+ 2. **Clear image cache if needed:**
710
+ ```swift
711
+ // CometChat handles image caching internally
712
+ // But you can clear URLCache if needed
713
+ URLCache.shared.removeAllCachedResponses()
714
+ ```
715
+
716
+ ---
717
+
718
+ ## 6. SwiftUI-Specific Issues
719
+
720
+ ### View Not Updating
721
+
722
+ **Cause:** SwiftUI not detecting state changes.
723
+
724
+ **Solution:**
725
+
726
+ ```swift
727
+ struct ChatView: View {
728
+ @State private var selectedConversation: Conversation?
729
+
730
+ var body: some View {
731
+ ConversationsWrapper(selectedConversation: $selectedConversation)
732
+ .onChange(of: selectedConversation) { newValue in
733
+ // Handle selection
734
+ }
735
+ }
736
+ }
737
+
738
+ struct ConversationsWrapper: UIViewControllerRepresentable {
739
+ @Binding var selectedConversation: Conversation?
740
+
741
+ func makeUIViewController(context: Context) -> CometChatConversations {
742
+ let vc = CometChatConversations()
743
+ vc.onItemClick = { conversation, _ in
744
+ selectedConversation = conversation
745
+ }
746
+ return vc
747
+ }
748
+
749
+ func updateUIViewController(_ uiViewController: CometChatConversations, context: Context) {
750
+ // Handle updates if needed
751
+ }
752
+ }
753
+ ```
754
+
755
+ ### Navigation Issues
756
+
757
+ **Cause:** Mixing UIKit navigation with SwiftUI.
758
+
759
+ **Solution:**
760
+
761
+ ```swift
762
+ struct ChatNavigationView: View {
763
+ @State private var path = NavigationPath()
764
+
765
+ var body: some View {
766
+ NavigationStack(path: $path) {
767
+ ConversationsView(onSelect: { conversation in
768
+ path.append(conversation)
769
+ })
770
+ .navigationDestination(for: Conversation.self) { conversation in
771
+ MessagesView(conversation: conversation)
772
+ }
773
+ }
774
+ }
775
+ }
776
+ ```
777
+
778
+ ---
779
+
780
+ ## 7. Quick Fixes Checklist
781
+
782
+ When something isn't working:
783
+
784
+ 1. [ ] **Clean build:** Cmd + Shift + K
785
+ 2. [ ] **Delete derived data:** `rm -rf ~/Library/Developer/Xcode/DerivedData`
786
+ 3. [ ] **Reinstall pods:** `pod deintegrate && pod install`
787
+ 4. [ ] **Check credentials:** App ID, Auth Key, Region
788
+ 5. [ ] **Check user exists:** Use test users or create first
789
+ 6. [ ] **Check network:** Device has internet connection
790
+ 7. [ ] **Check permissions:** Camera, microphone, notifications
791
+ 8. [ ] **Check main thread:** UI updates on main thread
792
+ 9. [ ] **Check completion handlers:** Wait for async operations
793
+ 10. [ ] **Enable logging:** `CometChat.setLogLevel(.debug)`
794
+
795
+ ---
796
+
797
+ ## 8. Theming Errors
798
+
799
+ ### "Value of type 'MessageBubbleStyle' has no member 'outgoingBackgroundColor'"
800
+
801
+ **Cause:** Incorrect property access for message bubble styles.
802
+
803
+ **Solution:** Message bubble styles use separate `.incoming` and `.outgoing` style objects, not combined properties:
804
+
805
+ ```swift
806
+ // ✅ CORRECT - Use separate incoming/outgoing styles
807
+ CometChatMessageBubble.style.outgoing.backgroundColor = CometChatTheme.primaryColor
808
+ CometChatMessageBubble.style.incoming.backgroundColor = CometChatTheme.neutralColor300
809
+
810
+ // For text colors within bubbles
811
+ CometChatMessageBubble.style.outgoing.textBubbleStyle.textColor = .white
812
+ CometChatMessageBubble.style.incoming.textBubbleStyle.textColor = CometChatTheme.textColorPrimary
813
+ ```
814
+
815
+ ---
816
+
817
+ ### "Value of type 'ConversationsStyle' has no member 'titleColor'"
818
+
819
+ **Cause:** Using incorrect property names for component styles.
820
+
821
+ **Solution:** Check the actual property names in the style struct:
822
+
823
+ ```swift
824
+ // ✅ CORRECT ConversationsStyle properties
825
+ CometChatConversations.style.listItemTitleTextColor = CometChatTheme.textColorPrimary
826
+ CometChatConversations.style.listItemTitleFont = CometChatTypography.Heading4.medium
827
+ CometChatConversations.style.listItemSubTitleTextColor = CometChatTheme.textColorSecondary
828
+ CometChatConversations.style.listItemSubTitleFont = CometChatTypography.Body.regular
829
+ ```
830
+
831
+ ---
832
+
833
+ ### "Value of type 'MessageComposerStyle' has no member 'inputBackgroundColor'"
834
+
835
+ **Cause:** Using incorrect property names for composer style.
836
+
837
+ **Solution:** Use the correct property names:
838
+
839
+ ```swift
840
+ // ✅ CORRECT MessageComposerStyle properties
841
+ CometChatMessageComposer.style.composeBoxBackgroundColor = CometChatTheme.backgroundColor01
842
+ CometChatMessageComposer.style.composeBoxBorderColor = CometChatTheme.borderColorDefault
843
+ CometChatMessageComposer.style.placeHolderTextColor = CometChatTheme.textColorTertiary
844
+ CometChatMessageComposer.style.textFiledColor = CometChatTheme.textColorPrimary
845
+ CometChatMessageComposer.style.activeSendButtonImageBackgroundColor = CometChatTheme.primaryColor
846
+ ```
847
+
848
+ ---
849
+
850
+ ### "Value of type 'BadgeStyle' has no member 'cornerRadius'" (type mismatch)
851
+
852
+ **Cause:** `BadgeStyle.cornerRadius` is `CometChatCornerStyle?`, not a simple value.
853
+
854
+ **Solution:**
855
+
856
+ ```swift
857
+ // ✅ CORRECT - cornerRadius is optional CometChatCornerStyle
858
+ CometChatBadge.style.cornerRadius = CometChatCornerStyle(cornerRadius: 8)
859
+ // or nil for default pill shape
860
+ CometChatBadge.style.cornerRadius = nil
861
+ ```
862
+
863
+ ---
864
+
865
+ ### "Cannot assign value of type 'UIColor' to type 'CGColor'"
866
+
867
+ **Cause:** `BadgeStyle.borderColor` is `CGColor`, not `UIColor`.
868
+
869
+ **Solution:**
870
+
871
+ ```swift
872
+ // ✅ CORRECT - use .cgColor
873
+ CometChatBadge.style.borderColor = UIColor.clear.cgColor
874
+ CometChatBadge.style.borderColor = UIColor.white.cgColor
875
+ ```
876
+
877
+ ---
878
+
879
+ ### Theme Changes Not Applying
880
+
881
+ **Cause:** Theme configured after UI is already displayed.
882
+
883
+ **Solution:** Configure theme before showing any CometChat UI:
884
+
885
+ ```swift
886
+ // In AppDelegate or App init, BEFORE showing any CometChat views
887
+ func configureTheme() {
888
+ CometChatTheme.primaryColor = UIColor.systemBlue
889
+ CometChatTheme.backgroundColor01 = UIColor.systemBackground
890
+ // ... other theme settings
891
+ }
892
+
893
+ // Call this before CometChatUIKit.init()
894
+ configureTheme()
895
+ ```
896
+
897
+ ---
898
+
899
+ ### "Type 'CometChatSpacing' has no member 'Spacing1'" or similar
900
+
901
+ **Cause:** Using incorrect property access for spacing values.
902
+
903
+ **Solution:** `CometChatSpacing` uses nested classes, not direct properties:
904
+
905
+ ```swift
906
+ // ✅ CORRECT - Use nested class syntax
907
+ CometChatSpacing.Spacing.s1 = 4
908
+ CometChatSpacing.Spacing.s2 = 8
909
+ CometChatSpacing.Padding.p1 = 4
910
+ CometChatSpacing.Padding.p2 = 8
911
+ CometChatSpacing.Radius.r1 = 4
912
+ CometChatSpacing.Radius.r2 = 8
913
+ CometChatSpacing.Radius.rMax = 1000
914
+ CometChatSpacing.Margin.m1 = 4
915
+ ```
916
+
917
+ ---
918
+
919
+ ### "Cannot infer type of closure parameter" or "Cannot infer contextual base"
920
+
921
+ **Cause:** Missing type annotations in closures for custom views.
922
+
923
+ **Solution:** Always provide explicit type annotations for closure parameters:
924
+
925
+ ```swift
926
+ import CometChatSDK
927
+
928
+ // ✅ CORRECT - Explicit type annotation
929
+ users.set(subtitle: { (user: User?) -> UIView in
930
+ let label = UILabel()
931
+ if user?.status == .online {
932
+ label.text = "Online"
933
+ label.textColor = .systemGreen
934
+ } else {
935
+ label.text = "Offline"
936
+ label.textColor = .gray
937
+ }
938
+ return label
939
+ })
940
+ ```
941
+
942
+ Note: Use `set(subtitle:)` method, not direct property assignment. The `User` type is from `CometChatSDK`.
943
+
944
+ ---
945
+
946
+ ### "Value of type 'CometChatUsers' has no member 'subtitleView'"
947
+
948
+ **Cause:** Using wrong property name.
949
+
950
+ **Solution:** `CometChatUsers` uses `subtitle`, not `subtitleView`:
951
+
952
+ ```swift
953
+ // ✅ CORRECT
954
+ users.set(subtitle: { (user: User?) -> UIView in
955
+ // Return custom view
956
+ })
957
+
958
+ // Different components use different names:
959
+ // - CometChatUsers: set(subtitle:)
960
+ // - CometChatConversations: set(subtitleView:)
961
+ // - CometChatMessageHeader: set(subtitleView:)
962
+ ```
963
+
964
+ ---
965
+
966
+ ## 10. Getting Help
967
+
968
+ ### CometChat Resources
969
+
970
+ - **Documentation:** https://www.cometchat.com/docs/ios-uikit
971
+ - **GitHub Issues:** https://github.com/cometchat/cometchat-uikit-ios/issues
972
+ - **Support:** https://www.cometchat.com/support
973
+
974
+ ### Information to Include in Bug Reports
975
+
976
+ 1. CometChatUIKitSwift version
977
+ 2. iOS version
978
+ 3. Xcode version
979
+ 4. Device (simulator or physical)
980
+ 5. Error message / stack trace
981
+ 6. Steps to reproduce
982
+ 7. Relevant code snippets
983
+