Monday, June 1, 2026
HomeiOS Developmentios - Notification delegate not being referred to as when app is...

ios – Notification delegate not being referred to as when app is in background when notification is acquired

[ad_1]

I’m utilizing firebase cloud messaging to ship push notifications to our iOS software. When the applying is within the foreground all the pieces works positive.

The issue is when i ship the app to the background after which ship a notification.

I anticipate the next delegate to be referred to as, however it isn’t:

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

I’ve ticked the “distant notifications” background mode in my apps signing & capabilities tab.

The payload i ship to firebase appears like this:

{"to":"--TOKEN--",
"precedence":"excessive",
"content_available":true,
"mutable_content": true,
"notification":
 {"physique":"Take a look at Notification",
 "title":"New Notification",
 "sound":"default",
 "click_action":"notification"
 }
}

This payload is shipped to firebase through https://fcm.googleapis.com/fcm/ship

When i click on an notification it’s then processed, and that i can see the apns model i obtain appears like this:

[AnyHashable("google.c.sender.id"): 8xxxxxxxx, AnyHashable("gcm.message_id"): 1xxxxxxxxxx, AnyHashable("google.c.a.e"): 1, AnyHashable("google.c.fid"): fxxxxxxxxx, AnyHashable("aps"): {
    alert =     {
        body = "Test Notification";
        title = "New Notification";
    };
    category = feedback;
    "content-available" = 1;
    "mutable-content" = 1;
    sound = default;
}]

I’m not certain why content-available and mutable-content seem in quotes? I do know firebase convers its payload to apns format, is there one thing fallacious right here?

I need the delegate to be referred to as in order that i can execute some code to keep up varied information gadgets, so it is vital that i can run some code when my app is within the background and a notification is acquired.

I’m not certain what config i’m lacking as all the pieces i learn appears to say that is all i must do?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments