Can I set UILocalnotification to repeat every last day of every month?

≡放荡痞女 提交于 2019-12-10 19:08:50

问题


I want to try this myself, but it would take a month before I can sure it work. Any one have ever try this ?

NSDate *fireDate = // Date I want to repeat, in this case 31 may 

localNotification.fireDate = fireDate;
localNotification.repeatInterval = NSMonthCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

I expected it to alert on the last day of every month. Is this a way to go ? And if I schedule it on 30-day month and the next day is 31-day month like April -> May What should I do, because I can only set it to 30 April (also February 28 and 29 day problem)


回答1:


I got an answer after playing with UILocalNotification for a while, If you want to make it repeat every last day every months just set it to January 31 with repeatInterval NSMonthCalendarUnit and it will repeat every last day of every months



来源:https://stackoverflow.com/questions/10739834/can-i-set-uilocalnotification-to-repeat-every-last-day-of-every-month

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!