Firebase Push notifications don't work on iOS 13

后端 未结 8 1508
轮回少年
轮回少年 2021-01-03 02:31

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

相关标签:
8条回答
  • 2021-01-03 02:58

    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.

    0 讨论(0)
  • 2021-01-03 02:59

    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.

    0 讨论(0)
  • 2021-01-03 03:12

    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"
      }
    }
    
    0 讨论(0)
  • 2021-01-03 03:16

    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 讨论(0)
  • 2021-01-03 03:16

    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

    0 讨论(0)
  • 2021-01-03 03:17

    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"
        }
    }
    
    0 讨论(0)
提交回复
热议问题