I have several notifications on my app. What i want to do is to, when a local notification arrived, it erases another previous already showed one from notification center.
I am using the the following code.
static func unscheduleNotification(userInfoValue: String){
if let notifications = UIApplication.sharedApplication().scheduledLocalNotifications{
for notification in notifications{
if let userInfo = notification.userInfo as? [String:String]{
if userInfo["info"] == userInfoValue{
UIApplication.sharedApplication().cancelLocalNotification(notification)
}
}
}
}
}
Would appreciate if someone point me out the right direction here. If that is even possible.