How to solve this problem? Please help me.
I used the following code in my project, but can't delete notification.
if #available(iOS 10.0, {
let center = UNUserNotificationCenter.current()
center.removeDeliveredNotifications(withIdentifiers: [String(self.chatRoom.getChatRoomID())])
} else {
// Fallback on earlier versions
}
var app:UIApplication = UIApplication.shared
for oneEvent in app.scheduledLocalNotifications! {
var notification = oneEvent as UILocalNotification
let userInfoCurrent = notification.userInfo! as! [String:AnyObject]
let uid = userInfoCurrent["TeamChatRoomID"]! as! String
if uid == String(self.chatRoom.getChatRoomID()){
//Cancelling local notification
app.cancelLocalNotification(notification)
break;
}
}