0

I just want to ask is this even possible? I've made simple method which as I suspect will fire notification every 1st day of month at 12:00 What I want to do is fires notifications 1st,2nd,3rd day of every month at for ex. 8:00 am and 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
}
janusfidel
  • 8,036
  • 4
  • 30
  • 53
Gorthez
  • 391
  • 3
  • 12
  • 1
    Just schedule 3 notifications for day 1, 2 and 3 at the desired time and repeat = true – Leo Dabus Apr 20 '17 at 19:02
  • Where is the rest of the UserNotification? Why are you mixing UILocalNotification? – Leo Dabus Apr 20 '17 at 19:04
  • 1
    Ahh so just as I expected. It's mixed because I firstly made it with localNotification.fireDate and then I discovered iOS 10 option with trigger so I added it. Thanks for help I think I get it now :-) – Gorthez Apr 20 '17 at 19:32

0 Answers0