Add the Kommunicate iOS SDK in your app using the following guide: https://docs.kommunicate.io/docs/ios-installation
-
Add the Firebase Core and FirebaseMessaging pods in the PodFile and run
pod install
.
(https://firebase.google.com/docs/cloud-messaging/ios/client#add-sdks) -
In the AppDelegate.swift file, set up the methods to configure Firebase and set the Firebase Messaging delegate. This includes methods to get the FCM token and refresh it whenever it changes.
(https://firebase.google.com/docs/cloud-messaging/ios/client#set-the-messaging-delegate)
- In AppDelegate.swift file’s
didReceiveRegistrationToken()
, pass the FCM registration token to Kommunicate server.
(https://docs.kommunicate.io/docs/ios-pushnotification#send-device-token-to-kommunicate-server)
-
To disable method swizzling: add the flag
FirebaseAppDelegateProxyEnabled
in the app’s Info.plist file and set it to NO (boolean value) -
For apps with method swizzling disabled, associating the FCM token with the device's APNs token and passing notification-received events to Analytics should be done manually.
To handle the app launch, when the user clicks on a notification, check if the notification received is a Kommunicate notification.
-
In the
userNotificationCenter(_:didReceive:withCompletionHandler:)
, pass the response dictionary to Kommunicate Notification Service’sisKommunicateNotification()
.
(https://docs.kommunicate.io/docs/ios-pushnotification#handle-app-launch-on-notification-click) -
If true, it can be then passed to process the notification, using the
processPushNotification(dict)
method. -
If false, the notification can be passed onto FCM’s
appDidReceiveMessage(_:)
method.
(https://firebase.google.com/docs/cloud-messaging/ios/receive#handle_messages_with_method_swizzling_disabled)