Могу добавить одну просьбу. Но когда я попытался добавить два, сработал только последний. Первый просто не появляется. Вот мой метод:
var triggerDailyEnd = DateComponents()
triggerDailyEnd.hour = hour
triggerDailyEnd.minute = minutes
triggerDailyEnd.weekday = i+1
// this repeat every day
let triggerEnd = UNCalendarNotificationTrigger(dateMatching: triggerDailyEnd, repeats: true)
let identifierEnd = getNotificationId(i+1, hour, minutes,true)
let requestEnd = UNNotificationRequest(identifier: identifierEnd, content: notifEnd, trigger: triggerEnd)
notificationCenter.add(requestEnd)
var triggerDailyStart = DateComponents()
triggerDailyStart.hour = hour
// correctly remove time
triggerDailyStart.minute = minutes-Int(ProgrammationViewController.PREHEAT_TIME)
triggerDailyStart.weekday = i+1
// this repeat every day
let triggerStart = UNCalendarNotificationTrigger(dateMatching: triggerDailyStart, repeats: true)
let identifierStart = getNotificationId(i+1, hour, minutes,false)
let requestStart = UNNotificationRequest(identifier: identifierStart, content: notifStart, trigger: triggerStart)
notificationCenter.add(requestStart)
код довольно прост. Когда я добавляю requestEnd после requestStart, срабатывает уведомление requestEnd, а не requestStart. И наоборот. Странный ?





Параметр identifier запроса должен быть уникальным. Если это то же самое, второй запрос перезапишет первый.