我只是想问这是否可能? 我做了一个简单的方法,因为我怀疑每个月的第一天都会在12:00发出通知 我想做的是每个月的第1天,第2天,第3天发出通知。上午8:00和12:00
func scheduleLocalNotification() {
let calendar = NSCalendar.autoupdatingCurrent
var calendarComponents = DateComponents()
calendarComponents.day = 1
calendarComponents.hour = 12
calendarComponents.minute = 00
let trigger = UNCalendarNotificationTrigger(dateMatching: calendarComponents, repeats: true)
let localNotification = UILocalNotification()
localNotification.alertBody = "Hey, you must go shopping, remember?"
localNotification.soundName = UILocalNotificationDefaultSoundName
}