我有一组本地通知,我计划通过在迭代数组中设置每一个的发布日期来发送。问题是由于某种原因,第一个通知未被发送,所有其他通知都被设置并发送正常。这是代码:
var notifi = 0
var firstDate = NSDate()
let dateArrays = Array(1...3)
for _ in dateArrays{
if notifi < 64 {
firstDate = firstDate.dateByAddingTimeInterval(10)
notification.category = "FIRST_CATEGORY"
notification.alertBody = "It's time to look away now!"
notification.fireDate = firstDate
UIApplication.sharedApplication().scheduleLocalNotification(notification)
notifi = notifi + 1
}else {
print("local notifications limit has been reached")
}
}