UNUserNotificationCenter 可以添加多个请求吗?

can UNUserNotificationCenter add multiple requests?

我可以添加一个请求。但是当我尝试发布两个广告时,只有最新的被解雇了。第一个只是没有出现。这是我的方法:

            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)

代码相当 simple.When 我在 requestStart 之后添加了 requestEnd,触发了 requestEnd 的通知而不是 requestStart.And 反之亦然。奇怪?

请求的 identifier 参数必须是唯一的。如果相同,则第二个请求将覆盖第一个。