Firebase Push notifications don't work on iOS 13

安稳与你 提交于 2020-04-10 03:52:09

问题


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


回答1:


Ref link here

Example Firebase push body

{
  "topic": "topic_test",
  "message": {
    "data": {
      "key": "some_value"
    },
    "notification": {
      "body": "description ~",
      "title": "title !"
    }
  },
  "options": {
    "mutableContent": true,
    "contentAvailable": true,
    "apnsPushType": "background"
  }
}



回答2:


Quick Fix Solution:

If you are facing issue to receive push notification on iOS version 13.2.X, then do below change in device settings and check again:

Device > Settings > Search your AppName > Notifications > Banner Style > Change it to "Persistent" from "Temporary" or vise-versa one time.

Now send push notification again and its start receiving.




回答3:


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.




回答4:


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




回答5:


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"
    }
}



回答6:


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.




回答7:


Could be to do with the way the push token gets pulled out of the Data object. I'm not super familiar with Firebase push notifications, but if you have to pass the push token to Firebase, you may need to change the way you get the token. If Firebase has an SDK that handles this, you may need to update it.

OneSignal talk about the change here.



来源:https://stackoverflow.com/questions/58198340/firebase-push-notifications-dont-work-on-ios-13

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!