比方說,這個字符串數組具有其已計劃在localNotification日期的字符串,有沒有辦法讓這些字符串,並將其轉換爲日期,然後刪除某一預定日期如何取消轉換爲NSDate後從字符串數組中取得的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)
}
查找'NSDateFormatter '把'NSDate'轉換成'NSString'或'NSString'成'NSDate'。 – Larme