Swift3 每月重复通知一次
以下代码行可以每周重复一次本地通知,对吗Swift3 每月重复通知一次,swift3,nsdatecomponents,localnotification,usernotifications,Swift3,Nsdatecomponents,Localnotification,Usernotifications,以下代码行可以每周重复一次本地通知,对吗 let triggerWeekly = Calendar.current.dateComponents([.weekday,hour,.minute,.second,], from: date) let trigger = UNCalendarNotificationTrigger(dateMatching: triggerWeekly, repeats: true) 但如何在每个月重复一次本地通知?计划每月通知需要哪些日期组件?您可以这样使用: le
let triggerWeekly = Calendar.current.dateComponents([.weekday,hour,.minute,.second,], from: date)
let trigger = UNCalendarNotificationTrigger(dateMatching: triggerWeekly, repeats: true)
但如何在每个月重复一次本地通知?计划每月通知需要哪些日期组件?您可以这样使用:
let triggerMonthly = Calendar.current.dateComponents([.day], from: date)
let trigger = UNCalendarNotificationTrigger(dateMatching: triggerMonthly, repeats: true)
你试过常见的成分还是日期?比如说。白天?@Willeke不!我还没有试过。如果计划的日期是31号,它会每两个月重复一次,而在2月份甚至会是最糟糕的。它永远也不会安排30号和29号也许是的也许not@LeoDabus这意味着不可能创造?