[英]UNUserNotification iOS 11: Dismiss single notification, not all
I built a simple todo app based on the reminders app and EKEvent. 我基于提醒应用程序和EKEvent构建了一个简单的待办事项应用程序。 Instead of setting an EKAlert for their due date, I built my own UNUserNotification, mainly because of custom action events I'd like to have.
我没有设置EKAlert的截止日期,而是构建了自己的UNUserNotification,这主要是因为我希望拥有自定义操作事件。 The code mainly follows the examples on this page: https://useyourloaf.com/blog/local-notifications-with-ios-10/
该代码主要遵循此页面上的示例: https : //useyourloaf.com/blog/local-notifications-with-ios-10/
For testing, the app is also scheduling EKAlarms with the same parameters. 为了进行测试,该应用程序还计划使用相同的参数来调度EKAlarms。 Now if I test with 2 todo entries like this:
现在,如果我用2个待办事项进行测试,如下所示:
I get 2 UserNotifications and 2 EKAlarm reminders in notification center at 10am. 上午10点,我在通知中心收到2个UserNotifications和2个EKAlarm提醒。 Now my Problem:
现在我的问题是:
I'd rather act on every todo on it's own: Some I want to dismiss, some to snooze, some to ignore altogether, all in notification center. 我宁愿对每个待办事项都采取行动:某些我想撤消,有些贪睡,完全忽略,所有这些都在通知中心内。
I tried: 我试过了:
So is there a way to schedule multiple notifications from an app, but have the user dismiss every single one of them? 因此,有没有一种方法可以从一个应用程序安排多个通知,但是用户是否将其中的每个通知都关闭了?
Thanks! 谢谢!
EDIT: this post suggests that the Problem is related to iOS 11 specifically. 编辑: 这篇文章建议该问题专门与iOS 11有关。 I think it describes my problem well, but way shorter :)
我认为它很好地描述了我的问题,但更简短了:)
EDIT 2: This appears to be a problem with iOS 11.2.x. 编辑2:这似乎是iOS 11.2.x的问题。 This radar: https://openradar.appspot.com/36019616 exactly describes my problem.
这个雷达: https : //openradar.appspot.com/36019616准确地描述了我的问题。
EDIT 3: As of iOS 11.2.6, the behaviour hasn't changed. 编辑3:从iOS 11.2.6,该行为没有更改。
EDIT 4: No change of behaviour in iOS 11.3. 编辑4:在iOS 11.3中行为没有变化。
EDIT 5: No change in iOS 11.4. 编辑5:在iOS 11.4中没有更改。
EDIT 6: Finally! 编辑6:最后! The iOS12 update "stacks" notifications together.
iOS12更新一起“堆叠”通知。 I can now handle every single alert/reminder the app is firing.
现在,我可以处理应用触发的每一个警报/提醒。
在content.body
添加一些文本:
content.body = 'Any text'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.