iOS 中的多个本地通知

Multiple local notifications in iOS

我正在制作一个 iOS 应用程序,可以提醒患者按时服药。例如,用户将选择 start dateend date 以及一天中的次数(在 9:00 am,1:00 pm 等)。用户还可以选择间隔几天或选择工作日服药。例如,仅在周一和周二。

是否有任何第三方 class 可以帮助我根据传递的参数获取日期列表?

此外,我在某处读到我们一次只能安排 64 个本地通知。在我的例子中,用户可以选择 start dateend date,这可能会导致超过 64 天。

我将如何管理它?我对这些事情一无所知。

Apple 文档说:

Each app on a device is limited to 64 scheduled local notifications. The system discards scheduled notifications in excess of this limit, keeping only the 64 notifications that will fire the soonest. Recurring notifications are treated as a single notification.

智能管理您的通知。那么这应该不是问题。尝试在一整天内生成最多 64 个通知,并将 UILocalNotification 的 repeatInterval 设置为 NSCalendarUnitDay。我想这会有所帮助。