Firebase push notifications aren\'t working on iOS 13. But works fine in iOS 12.4. Any solution?
Edited: 04.10.19
Silent push notification not working iOS 13
If the delegate didRegisterForRemoteNotificationsWithDeviceToken
triggering failed, try changing the network. I changed it to cellular data & it started working again
Also, if you used your internet connection in the MAC to share using USB. Turn it off & connect your IPhone with a normal wifi or mobile data.
Prior to iOS 13 I had an issue of not receiving push notifications because I didn't select in XCode - Signing and Capabilities -> Background Modes -> Background Fetch. After I selected it everything worked fine. After iOS 13 I have the same issue of not receiving push notifications anymore. Today I saw that in XCode the Background Fetch option was unselected again. Maybe something happened after the update of the XCode??
I haven't test it yet. Check if this is a solution for you.
Ref link here
{
"topic": "topic_test",
"message": {
"data": {
"key": "some_value"
},
"notification": {
"body": "description ~",
"title": "title !"
}
},
"options": {
"mutableContent": true,
"contentAvailable": true,
"apnsPushType": "background"
}
}
Hope you add Notification delegate and other method
So first can you try with postman using this below link
https://fcm.googleapis.com/fcm/send
In postman header 1). Authorization = key="Add Firebase server key" 2). Content-Type = application/json
In postman body as row
{ "to" : "Your iPhone Device FCM Toen", "notification" : { "body" : "Body of Your Notification", "title": "Title of Your Notification", "sound": "default", "alert":"New" }, "priority": "high", "contentAvailable": true, "data" : { "body" : "Body of Your Notification in Data", "title": "Title of Your Notification in Title", "key_1" : "Value for key_1", "key_2" : "Value for key_2", } }
First try using postman with above example and check in iOS 13
I had the same issue after updating my Pods. As of Version 6.18.0:
Deprecated FCM direct channel messaging via shouldEstablishDirectChannel. Instead, use APNs for downstream message delivery. Add content_available key to your payload if you want to continue use legacy APIs, but we strongly recommend HTTP v1 API as it provides full APNs support. The deprecated API will be removed in Firebase 7 (#4710)." Release notes.
In my AppDelegate I commented out 2 lines of code:
func connectToFCM() {
// Messaging.messaging().shouldEstablishDirectChannel = true
}
func disconnectFCM() {
// Messaging.messaging().shouldEstablishDirectChannel = false
}
Everything seemed to be working when I would send a notification to my device using it's device token. However, after uploading my update to the App Store I was seeing
0% of potential users are eligible for this campaign: 0
I re-downloaded the GoogleService-Info.plist from Firebase and compared it to what was already in my xcworkspace. The GOOGLE_APP_ID had changed. So, replacing the .plist fixed it. I’m not sure why the info in the .plist would change. Hope this helps.
ps- current Pods are 6.23.0
Maybe its pattern of iOS13 bug or updates, This will be work for iOS12 & iOS13
{
"to":"",
"priority":"high",
"content_available":true,
"data":{
"abc":"abc"
},
"notification":{
"body":"abc"
}
}
Or
{
"to":"",
"priority":"high",
"content_available":true,
"data":{
"abc":"abc"
}
}