FCM Push notifications do not work on iOS 11

后端 未结 5 645
遇见更好的自我
遇见更好的自我 2020-12-03 13:44

I use Firebase as a backend. I also use FCM as one of the provided features from Firebase. FCM worked well in iOS 10, but after switching to iOS 11, push notifications stopp

5条回答
  •  执念已碎
    2020-12-03 14:26

    Seems to be an issue with Firebase SDK where push notifications stop working after app relaunch or when killed. A work around for this was suggested:

    let deleteCount = UserDefaults.standard.integer(forKey: "oneTimeWorkaroundKey")
            if deleteCount == 0 {
                InstanceID.instanceID().deleteID { error in
                    if let cError = error {
                        log("APNS: Error on delete: \(cError)")
                    } else {
                        UserDefaults.standard.set(deleteCount + 1, forKey: "oneTimeWorkaroundKey")
                    }
                }
            } 
    

    Heres a link to see the discussions held about this, one case is still open trying to resolve this issue https://github.com/firebase/firebase-ios-sdk/issues/2438

提交回复
热议问题