Ahmad Khawatmi Ahmad Khawatmi - 1 year ago 98
iOS Question

how to cancel a localNotification taken from an array of strings after being converted to NSDate?

Let’s say this StringArray has strings of Dates which are already scheduled in localNotification, is there a way to get those strings, convert them to dates and then remove a certain scheduled date

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])


Answer Source
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) {