5

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

2
  • Which xCode you used for generating build?
    – Manish
    Commented Dec 3, 2019 at 5:16
  • I was also facing same issues on 13.2.1, I was not even able get notifications for gmail app, but when I updated iOS version to 13.3 all notifications begin to receive. and issue is resolved.
    – Nitesh
    Commented Dec 20, 2019 at 11:05

8 Answers 8

8

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.

enter image description here

2
  • 1
    This worked for me. Any idea why this works? Don't want to force my users to do this..
    – korrekorre
    Commented Mar 28, 2020 at 8:33
  • Yeah, any idea how to accomplish whatever this does in code? This is not a reliable or scalable solution for thousands and thousands of users. :\ It did work though, in my testing.
    – chornbe
    Commented Aug 26, 2020 at 22:20
4

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.

1
  • 1
    I think this fixed it for me too! I needed to add the background modes 1. Remote notifications and 2. Background processing. Remote notifications was selected all the time. With background processing, I'm not sure if it was selected and then somehow deselected. But with both enabled, push messages are working again. Thanks!
    – Sneek
    Commented Jun 28, 2020 at 19:29
3

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"
  }
}
1
  • this "contentAvailable": true worked for me. Thanks
    – pajtimid
    Commented Jan 10, 2020 at 9:26
2

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

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.

1

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

0

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.

0

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.