草庐IT

UNCalendarNotificationTrigger

全部标签

iOS 10 : How to repeat local notification once fired on particular date?

我想在特定日期创建一个本地通知,然后在该本地通知被触发后每30秒重复一次。这是我的代码:letcalendar=Calendar(identifier:.gregorian)letcomponents=calendar.dateComponents(in:.current,from:date)letnewComponents=DateComponents(calendar:calendar,timeZone:.current,month:components.month,day:components.day,hour:components.hour,minute:components.

ios - 除非 repeats 为真,否则不会存储 UNCalendarNotificationTrigger

我注意到,如果我创建一个带有自定义日期的UNCalendarNotificationTrigger,它不会被添加,除非我输入:让trigger=UNCalendarNotificationTrigger(dateMatching:components,repeats:**true**)苹果的例子是:letdate=DateComponents()date.hour=8date.minute=30lettrigger=UNCalendarNotificationTrigger(dateMatching:date,repeats:true)repeats==true是有意义的。在我的场景中