4

I just want to schedule a same local notification in Swift. For example I just want to schedule a message saying "It's time to calculate your bill for this month" and I want to send this same message again next month.

How to do this kind of local notification in Swift?

I have referenced followings but was not able to schedule a same message in next month ...

//http://thecodeninja.tumblr.com/post/89942124085/notifications-in-ios-8-part-1-using-swift-what-is //From String to NSDate in Swift

Community
  • 1
  • 1
Ankahathara
  • 2,866
  • 2
  • 20
  • 26

1 Answers1

7

UILocalNotification has a repeatInterval property that lets you specify how often the notification should repeat. Note that this is an NSCalendarUnit, not just an arbitrary number, so you can only make a notification repeat once per calendar unit (second, minute, hour, day, week, month, etc.). See the NSCalendarUnit documentation for more options.

For example, you can make a notification repeat every month with:

notification.repeatInterval = .CalendarUnitMonth
Greg
  • 9,068
  • 6
  • 49
  • 91