假设这个StringArray有已经在localNotification中安排的Dates字符串,有没有办法获取这些字符串,将它们转换为日期然后删除某个预定日期
var arr = ["2016-08-27 19:29:50 +0000","2016-09-20 17:19:50 +0000","2016-07-27 10:20:30 +0000"]**
func locaNotification(num:Int)
{
let notification = UILocalNotification()
let notifTime = NSDate(notificationTime[num])
UIApplication.sharedApplication().cancelLocalNotification(notification)
}
答案 0 :(得分:1)
let arrLocalNotif = UIApplication.sharedApplication().scheduledLocalNotifications
for (let localN in arrLocalNotif) {
let notificationFireDate = localN.fireDate;
//convert string array value to date object and Compair this bothdate
if(compair true) {
UIApplication.sharedApplication().cancelLocalNotification(notification)
break
}
}