iphone - 合并具有相同 firedate 的 UILocalNotifications

标签 iphone ios uilocalnotification

有什么方法可以将同时触发的两个(或更多)UILocalNotifications 合并在一起。假设我有两个提醒在今天中午 12 点触发:

1) 洗碗 2)买牛奶

我现在拥有的是(因为我已经安排了两个单独的计时器)两个单独的警报;一个叫我洗碗,一个叫我去买牛奶。

我试图实现的是一个提醒,告诉我既要洗碗又要买牛奶。

我读到过,对于像这样的任务,APNS 可能是更好的选择,但由于缺乏合适且稳定的服务器,并且为了尽可能降低复杂性,我正在研究这是否可以只需使用 UILocalNotifications 即可完成。

我想出的唯一解决方案是创建一些逻辑来检查是否有任何具有相同触发日期的通知,如果有,则将它们都删除并创建一个新的合并通知,其中包含来自这两个通知的信息。

有什么建议吗?

最佳答案

The only solution I have come up with is to create some logic that checks if there's any notifications with the same fire dates and if there is, removing them both and creating a new, merged notification with information from both.

这正是要走的路。实现起来应该也不是很困难。

关于iphone - 合并具有相同 firedate 的 UILocalNotifications,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8787028/

相关文章:

ios - 将字符串保存到 NSUserDefaults?

ios - launchOptions 'UIApplicationLaunchOptionsLocalNotificationKey' 是否包含 NSDictionary 或 UILocalNotification

ios - 如何区分本地通知

ios - dyld : Library not loaded: @rpath/Stripe. 框架/Stripe

iphone - Siri SDK 可用吗?

iphone - 以编程方式找出谁对我们的 iPhone 应用程序给予了 5 星评级

ios - 从推送通知更新 sqlite 数据库,应用程序已关闭且未在后台 iOS 中运行

ios - 代码签名错误 : code signing is required for product type 'Application' in SDK 'iOS 7. 0

ios - 速度 slider 问题 - 鼓音序器 Obj - C

iphone - 设置 UILocalNotification 的 fireDate