简体   繁体   中英

How to schedule a same local notification in swift

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM