From 937fa2f65f1fcb65db5b5945bc070acc268297c1 Mon Sep 17 00:00:00 2001 From: ami-aman <91549653+ami-aman@users.noreply.github.com> Date: Wed, 6 Mar 2024 16:20:04 +0400 Subject: [PATCH 1/2] fix --- Apps/CocoaPods-FCM/src/AppDelegate.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Apps/CocoaPods-FCM/src/AppDelegate.swift b/Apps/CocoaPods-FCM/src/AppDelegate.swift index d4f99a01b..e1fdd7722 100644 --- a/Apps/CocoaPods-FCM/src/AppDelegate.swift +++ b/Apps/CocoaPods-FCM/src/AppDelegate.swift @@ -34,10 +34,6 @@ class AppDelegate: NSObject, UIApplicationDelegate { MessagingPushFCM.initialize { config in config.autoFetchDeviceToken = true } - - // Manually get FCM device token. Swizzling hasn't been working for me. - Messaging.messaging().delegate = self - /** Registers the `AppDelegate` class to handle when a push notification gets clicked. This line of code is optional and only required if you have custom code that needs to run when a push notification gets clicked on. @@ -50,7 +46,12 @@ class AppDelegate: NSObject, UIApplicationDelegate { return true } + // Because this is a SwiftUI app, we need to add this function to inform FCM about an APN token being registered. + // Without this function, the FCM delegate will not be called with a FCM token registered. + // Docs: https://firebase.google.com/docs/cloud-messaging/ios/client#token-swizzle-disabled func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { + // You may or may not set apnsToken here + // Adding this method will also serve the purpose Messaging.messaging().apnsToken = deviceToken } } From d3813e74e0affa5d9a0c1121067354a9338c6f0f Mon Sep 17 00:00:00 2001 From: ami-aman <91549653+ami-aman@users.noreply.github.com> Date: Wed, 6 Mar 2024 16:20:18 +0400 Subject: [PATCH 2/2] lint --- Sources/Common/Service/Request/MetricRequest.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/Common/Service/Request/MetricRequest.swift b/Sources/Common/Service/Request/MetricRequest.swift index 14ff5ebda..249760004 100644 --- a/Sources/Common/Service/Request/MetricRequest.swift +++ b/Sources/Common/Service/Request/MetricRequest.swift @@ -1,4 +1,3 @@ - import Foundation // https://customer.io/docs/api/#operation/pushMetrics