0

I have an iOS app that supports iOS 10 and above and it's working fine, now I want to support iOS 9 I have the following code that is working fine on iOS 10:

let ceneter = UNUserNotificationCenter.current()
        var idsToRemove = [String]()
        ceneter.getDeliveredNotifications { (notificatios) in
            for notifc in notificatios {
                if let type = notifc.request.content.userInfo["ntf_type"] as? String {
                    if type == "13" {
                        idsToRemove.append(notifc)
                    }
                }
            }
            ceneter.removeDeliveredNotifications(withIdentifiers: idsToRemove)
        }

What is the equivalent to the above code that would run on iOS 9? or how I can remove a specific notification?

I'm using Xcode 11.5 with swift 4.2

0 Answers0