cometchat-ios-push
cometchat/cometchat-skills/skills/cometchat-ios-push/SKILL.md
Add push notifications to an iOS CometChat app — APNs registration, token handoff, tap-to-open, badge counts and VoIP call pushes. Triggers: 'push notifications cometchat ios', 'apns cometchat', 'open chat from notification ios', 'voip push call ios'.
Skill118 starsChanged 58 days ago
What's in it
- Companion skills (read first)
- Use this skill when
- What you must have before any code
- The shape of the integration — use CometChatPushNotifications, do NOT hand-roll
- VoIP / calls
- Gotchas
- Verify it works
--- name: cometchat-ios-push description: "Add push notifications to an iOS CometChat app — APNs registration, token handoff, tap-to-open, badge counts and VoIP call pushes. Triggers: 'push notifications cometchat ios', 'apns cometchat', 'open chat from notification ios', 'voip push call ios'." license: "MIT" compatibility: "CometChatUIKitSwift 5.1.22 · CometChatSDK 4.1.7 · iOS 15.1+" metadata: author: "CometChat" version: "1.0.0" tags: "cometchat ios push apns voip pushkit notifications swift v5" --- ## Companion skills (read first) - `cometchat-ios-core` owns setup and login. This skill ADDS delivery. It is **docs-first and thin**: push depends on your Apple account, certificates and Dashboard configuration, so fetch the notifications docs via `cometchat-ios-core/references/docs-map.md` rather than trusting a baked recipe. ## Use this skill when "add push notifications", "open the right chat when a notification is tapped", "ring on an incoming call while backgrounded". ## What you must have before any code Push is **not** a code-only feature. All of these are prerequisites and none are things a skill can do for the user: an Apple Developer account with the Push Notifications capability, an APNs key or certificate uploaded to the **CometChat Dashboard**, and the Notifications product enabled for the app. If any are missing, say so plainly and stop — do not emit code that cannot work. ## The shape of the integration — use `CometChatPushNotifications`, do NOT hand-roll The current, canonical iOS path is the **`CometChatPushNotifications`** SDK (module `CometChatPushNotificationsSwift`), the same one `cometchat-ios-v5-sdk` documents. Do **not** hand-roll `UIKitSettings.set(deviceToken:)` / `set(voipToken:)`, `PKPushRegistryDelegate` or `CXProviderDelegate` — those setters exist but are the legacy path the sample app and current docs no longer use. 1. Request authorisation and register for remote notifications (on a real device — **the simulator does not receive APNs**). 2. After `CometChat.init`, call `CometChatPushNotifications.shared.initialize(config:)` and set its `.delegate`. In `didRegisterForRemoteNotificationsWithDeviceToken`, forward the APNs token with `CometChatPushNotifications.shared.registerDeviceToken(_:)`. **Ordering is not your problem** — the token can arrive before login; the SDK caches it and binds it to the user automatically once you initialize and the user logs in. (There is no need to gate `didRegister…` on login, and no `set(deviceToken:)` call.) 3. Handle the tap: read the payload, resolve the conversation, and push your chat screen — the same screen core builds. A notification that opens the app to the wrong place is the push equivalent of a dead-end affordance. 4. **Log out unregisters.** Leaving a stale token delivers a user's messages to a device someone else may now be using — treat it as a correctness and privacy requirement, not a nicety. ## VoIP / calls Ringing while backgrounded is **also `CometChatPushNotifications`**, not a hand-rolled channel: it owns PushKit + CallKit for you (`registerForVoIPPushes()`, `presentCallScreen(for:sessionId:)`). **Never write your own `PKPushRegistryDelegate` / `CXProviderDelegate` or call `UIKitSettings.set(voipToken:)`** — the SDK owns both and a hand-rolled one fights it for the same callbacks. Full VoIP wiring lives in `cometchat-ios-v5-sdk` (§ "VoIP call notifications"); it needs an APNs **VoIP** provider in the Dashboard, the Voice-over-IP Background Mode, and a physical device. ## Gotchas - **Simulator cannot verify this.** Delivery must be checked on a physical device; expect the automated gate to report push as blocked-external. - **Badge counts drift** unless you update and clear them deliberately. - **Sandbox vs production APNs** are different environments — a token from one will not deliver on the other. ## Verify it works On a real device: background the app, send a message from another user, see the notification, tap it and land in the right conversation. Then log out and confirm notifications stop.
More agent context in cometchat/cometchat-skills
97 other files this repository gives its agents, the first 60 shown.
Skill
- cometchat-a11yskills/cometchat-a11y/SKILL.md
- cometchat-analyticsskills/cometchat-analytics/SKILL.md
- cometchat-android-v5-calls-sdkskills/cometchat-android-v5-calls-sdk/SKILL.md
- cometchat-android-v5-sdkskills/cometchat-android-v5-sdk/SKILL.md
- cometchat-android-v6-builder-settingsskills/cometchat-android-v6-builder-settings/SKILL.md
- cometchat-android-v6-callsskills/cometchat-android-v6-calls/SKILL.md
- cometchat-android-v6-compose-componentsskills/cometchat-android-v6-compose-components/SKILL.md
- cometchat-android-v6-compose-customizationskills/cometchat-android-v6-compose-customization/SKILL.md
- cometchat-android-v6-compose-placementskills/cometchat-android-v6-compose-placement/SKILL.md
- cometchat-android-v6-coreskills/cometchat-android-v6-core/SKILL.md
- cometchat-android-v6-eventsskills/cometchat-android-v6-events/SKILL.md
- cometchat-android-v6-extensionsskills/cometchat-android-v6-extensions/SKILL.md
- cometchat-android-v6-featuresskills/cometchat-android-v6-features/SKILL.md
- cometchat-android-v6-kotlin-componentsskills/cometchat-android-v6-kotlin-components/SKILL.md
- cometchat-android-v6-kotlin-customizationskills/cometchat-android-v6-kotlin-customization/SKILL.md
- cometchat-android-v6-kotlin-placementskills/cometchat-android-v6-kotlin-placement/SKILL.md
- cometchat-android-v6-migrationskills/cometchat-android-v6-migration/SKILL.md
- cometchat-android-v6-productionskills/cometchat-android-v6-production/SKILL.md
- cometchat-android-v6-pushskills/cometchat-android-v6-push/SKILL.md
- cometchat-android-v6-testingskills/cometchat-android-v6-testing/SKILL.md
- cometchat-android-v6-troubleshootingskills/cometchat-android-v6-troubleshooting/SKILL.md
- cometchat-angular-v5-callsskills/cometchat-angular-v5-calls/SKILL.md
- cometchat-angular-v5-componentsskills/cometchat-angular-v5-components/SKILL.md
- cometchat-angular-v5-coreskills/cometchat-angular-v5-core/SKILL.md
- cometchat-angular-v5-customizationskills/cometchat-angular-v5-customization/SKILL.md
- cometchat-angular-v5-featuresskills/cometchat-angular-v5-features/SKILL.md
- cometchat-angular-v5-migrationskills/cometchat-angular-v5-migration/SKILL.md
- cometchat-angular-v5-patternsskills/cometchat-angular-v5-patterns/SKILL.md
- cometchat-angular-v5-placementskills/cometchat-angular-v5-placement/SKILL.md
- cometchat-angular-v5-productionskills/cometchat-angular-v5-production/SKILL.md
- cometchat-angular-v5-pushskills/cometchat-angular-v5-push/SKILL.md
- cometchat-angular-v5-testingskills/cometchat-angular-v5-testing/SKILL.md
- cometchat-angular-v5-troubleshootingskills/cometchat-angular-v5-troubleshooting/SKILL.md
- cometchat-auditskills/cometchat-audit/SKILL.md
- cometchat-complianceskills/cometchat-compliance/SKILL.md
- cometchat-flutter-v5-sdkskills/cometchat-flutter-v5-sdk/SKILL.md
- cometchat-flutter-v6-callsskills/cometchat-flutter-v6-calls/SKILL.md
- cometchat-flutter-v6-componentsskills/cometchat-flutter-v6-components/SKILL.md
- cometchat-flutter-v6-coreskills/cometchat-flutter-v6-core/SKILL.md
- cometchat-flutter-v6-customizationskills/cometchat-flutter-v6-customization/SKILL.md
- cometchat-flutter-v6-eventsskills/cometchat-flutter-v6-events/SKILL.md
- cometchat-flutter-v6-featuresskills/cometchat-flutter-v6-features/SKILL.md
- cometchat-flutter-v6-migrationskills/cometchat-flutter-v6-migration/SKILL.md
- cometchat-flutter-v6-patternsskills/cometchat-flutter-v6-patterns/SKILL.md
- cometchat-flutter-v6-placementskills/cometchat-flutter-v6-placement/SKILL.md
- cometchat-flutter-v6-productionskills/cometchat-flutter-v6-production/SKILL.md
- cometchat-flutter-v6-pushskills/cometchat-flutter-v6-push/SKILL.md
- cometchat-flutter-v6-testingskills/cometchat-flutter-v6-testing/SKILL.md
- cometchat-flutter-v6-troubleshootingskills/cometchat-flutter-v6-troubleshooting/SKILL.md
- cometchat-i18nskills/cometchat-i18n/SKILL.md
- cometchat-ios-callsskills/cometchat-ios-calls/SKILL.md
- cometchat-ios-componentsskills/cometchat-ios-components/SKILL.md
- cometchat-ios-coreskills/cometchat-ios-core/SKILL.md
- cometchat-ios-customizationskills/cometchat-ios-customization/SKILL.md
- cometchat-ios-featuresskills/cometchat-ios-features/SKILL.md
- cometchat-ios-migrationskills/cometchat-ios-migration/SKILL.md
- cometchat-ios-placementskills/cometchat-ios-placement/SKILL.md
- cometchat-ios-productionskills/cometchat-ios-production/SKILL.md
- cometchat-ios-testingskills/cometchat-ios-testing/SKILL.md
- cometchat-ios-troubleshootingskills/cometchat-ios-troubleshooting/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
Reports can't be read right now.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

