我可以将 UILocalnotification 设置为每个月的最后一天重复吗? [英] Can I set UILocalnotification to repeat every last day of every month?

查看:21
本文介绍了我可以将 UILocalnotification 设置为每个月的最后一天重复吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自己尝试一下,但需要一个月的时间才能确定它是否有效.有人试过吗?

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];

我预计它会在每个月的最后一天发出警报.这是一条路吗?如果我把它安排在 30 天的月份,第二天是 31 天的月份,如四月 -> 五月我该怎么办,因为我只能将其设置为 4 月 30 日(也是 2 月 28 日和 29 日的问题)

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)

推荐答案

玩了一段时间 UILocalNotification 后得到了答案,如果你想让它每个月的最后一天重复只需设置使用 repeatInterval NSMonthCalendarUnit 到 1 月 31 日,它将在每个月的最后一天重复

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

这篇关于我可以将 UILocalnotification 设置为每个月的最后一天重复吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆