转换为 NSDate 后如何取消从字符串数组中获取的 localNotification?
how to cancel a localNotification taken from an array of strings after being converted to NSDate?
假设这个 StringArray 包含已在 localNotification 中安排的日期字符串,有没有办法获取这些字符串,将它们转换为日期,然后删除某个预定日期
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)
}
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
}
}
假设这个 StringArray 包含已在 localNotification 中安排的日期字符串,有没有办法获取这些字符串,将它们转换为日期,然后删除某个预定日期
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)
}
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
}
}