首页 > 解决方案 > 使用 DateComponents 设置重复通知触发器

问题描述

目前正在开发一个应用程序需要设置不同类型的重复通知规则

喜欢每天重复,工作日,工作日或一周中的几天。

var dateInfo = DateComponents()
dateInfo.hour = 7
dateInfo.minute = 0
dateInfo.weekday = 1
let trigger = UNCalendarNotificationTrigger(dateMatching: dateInfo, repeats: true)

使用这个API每次只能添加一周中的一天,有没有简单的方法。

赞赏

标签: iosswiftnotificationsnsdatecomponentsunnotificationtrigger

解决方案


推荐阅读