Silent push notification not working on foreground iOS app
Well, after struggling with this for days I stumbled upon my answer barely an hour after posting this question.
To get background notifications delivered to your app you must call UIApplication.shared.registerForRemoteNotifications()
every time your app is launched. I was skipping the call if I already had the token and this was causing my delegate method to not be called.
iOS Silent Push notifications are failing with message
It is working now, I was using api.sandbox.push.apple.com:443 which is mentioned in https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns/
when I switched to api.development.push.apple.com:443, it works fine
Firebase iOS silent push notification stop to be delivered in background (after a while)
Sounds to me like you've got your app configured correctly for FIRMessaging(), but not for APNs.
Here's the thing: Firebase Messaging is only used for sending data-only messages when your app is in the foreground. By definition, it doesn't work when your app is in the background -- if you're trying to send messages to your app in the background, Firebase Cloud Messaging routes your message through APNs, which is received through normal APNs-y methods, like application(_:didReceiveRemoteNotification:fetchCompletionHandler:)
.
If you want more information on this topic, maybe I humbly suggest the Debugging Firebase Cloud Messaging on iOS post on the Firebase blog.
Related Topics
Checking a Null Value in Objective-C That Has Been Returned from a JSON String
Storing Authentication Tokens on iOS - Nsuserdefaults VS Keychain
Setneedslayout and Setneedsdisplay
How Is the Relation Between Uiview's Clipstobounds and Calayer's Maskstobounds
How to Set the Uinavigationbar with Gradient Color
Debug on Real Apple Watch: Application Verification Failed
Uicollectionview Update a Single Cell
Find List of Local Notification the App Has Already Set
Swift Performseguewithidentifier Not Working
How to Both Stroke and Fill with Nsattributedstring W/ Uilabel
Share Extension to Open Containing App
How to Check If My Avplayer Is Buffering
How to Display an Image Using Url
How to Detect Whether Custom Keyboard Is Activated from the Keyboard's Container App
Phonegap 3.0 iOS Plugins Not Found
Uploading Archive Error: "Missing iOS Distribution Signing Identity for ..."
What Are the Benefits of Using Storyboards Instead of Xib Files in iOS Programming