I would like to know how to receive and process FCM in force-quit state in swift.

Asked 2 years ago, Updated 2 years ago, 50 views

Hello, I'm a new developer. We are currently writing the FCM part. I couldn't find the answer even though I searched the Internet for a few days and went into Apple's website, so I posted this. Here's the current situation. I understand that Firebase now handles requests written in HTTP and XMPP and forwards them to the client, iPhone. For HTTP,

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any],    fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)

I know it's processed by a function For XMPP,

func applicationReceivedRemoteMessage(_ remoteMessage: FIRMessagingRemoteMessage)

I understand that the function handles it.

Back to the point When written in HTTP, the force-quit state, i.e., FCM appears properly even when the application is terminated (I don't know exactly how it works because I can't check the log when the application dies in xcode...) If it is written with XMPP, there is no response, and when the application is turned on, it is checked that it comes into the function mentioned above.

So I would like to know how to float FCM written in XMPP even after the application is terminated. If not, I wonder how the FCM coming to HTTP can be handled (e.g., sound elimination, vibration, etc.).

firebase swift ios

2022-09-22 11:43

1 Answers

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any],    fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)

is an APNS handling function, and

func applicationReceivedRemoteMessage(_ remoteMessage: FIRMessagingRemoteMessage)

is estimated to be a handling function that receives messages stored on the FCM.

Parameters such as eliminating sound or vibrating should be included in the payload sent to the FCM. Please refer to the link below.

https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support


2022-09-22 11:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.