iOS 10:每月从特定日期重复本地用户通知

时间:2017-07-19 20:18:19

标签: swift ios10

通知将在25-7-2017中使用:UNCalendarNotificationTrigger(dateMatching: dueDate , repeats: false)

触发

我如何每月重复通知,即25-8-2017,25-9-2017等。

1 个答案:

答案 0 :(得分:3)

不是在初始化触发器时提供完整日期,而是传递一组仅包含该月中某天的DateComponents,并将repeats设置为true

let components = DateComponents(day: 25)
let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: true)
相关问题