重复显示当前日期的通知

Repeat notification that shows current date

我正在尝试让本地通知每天重复并显示当前日期。 我怎样才能做到这一点?

我试过使用类似

的东西
localNotification.repeatInterval = .Day
localNotification.alertBody = "currentdate: \(NSDate())"

但在那种情况下它会一直显示 "first fire date"

我可以将它们一个接一个地安排在即将到来的日期,但是根据 documentation.

这样我只能收到 64 条通知

alertBody 只是一个 NSString 属性。所以每次显示通知时都不会计算它。这就是为什么你不能在那里显示 "changeable" 文本的原因。

如果出于某种原因您需要在通知中显示当前 "date",请尝试将显示的文本更改为 "now" 或仅显示没有 "day" 组件的预定时间。