简体   繁体   English

知道iOS通知是否被解雇

[英]Know if iOS notification was dismiss

Is there any way to know if a local notification was dismiss from the Notification Center (for example by pressing the x button)? 有没有办法知道本地通知是否从通知中心解除(例如按下x按钮)?

Is it possible to get a list of all the notifications currently visible in the Notification Center? 是否可以获取通知中心当前可见的所有通知的列表?

No it's not possible to get list of notifications from any of APIs from Apple. 不可以从Apple的任何API获取通知列表。 And no there is no feedback from ignored / closed notifications. 并且没有忽略/关闭通知的反馈。

If you want to implement logic like that, I would propose to build this type of logic based on your own servers. 如果你想实现这样的逻辑,我建议基于你自己的服务器构建这种类型的逻辑。

  1. When you send a notification you keep information about it on server side. 当您发送通知时,您会在服务器端保留有关它的信息。
  2. When you open the app from notification (that it's doable) you send information to a server side. 当您从通知中打开应用程序(它是可行的)时,您将信息发送到服务器端。
  3. When you open the app not from notification you can have a logic on a server side checking if there were any notification that were not confirmed from the last time you opened the application. 当您打开应用程序而不是通知时,您可以在服务器端具有逻辑,检查是否有任何通知在您上次打开应用程序时未得到确认。

Keep in mind that notifications are not always delivered - it's not guarantee that user will get them and if use has notifications turned of for your application - all notifications will be treated as ignored. 请记住,通知并非始终传递 - 并不保证用户会获得通知,如果使用已为您的应用程序启用通知 - 所有通知都将被视为已忽略。 To improve that logic you may want to send information about user permissions for notifications to your servers - which still is not guarantee that he didn't disable them in settings :( 要改进该逻辑,您可能希望将有关通知的用户权限的信息发送到您的服务器 - 这仍然不能保证他没有在设置中禁用它们:(

Long story short - never ever build any of your application core functionality based on notifications. 简而言之 - 永远不会根据通知构建任何应用程序核心功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 关闭来自 NotificationContentExtention 的 IOS 通知 - Dismiss IOS Notification from NotificationContentExtention Swift iOS 系统通知关闭回调 - Swift iOS system notification dismiss calback 关闭iOS Notification Content Extension中的键盘 - Dismiss keyboard in an iOS Notification Content Extension UNUserNotification iOS 11:关闭单个通知,而不是全部 - UNUserNotification iOS 11: Dismiss single notification, not all iOS:以编程方式关闭锁定屏幕上显示的通知? - iOS: Programmatically dismiss a notification that is displayed on lock screen? 我们如何知道通知已到达iOS设备? - how we know that notification reached to iOS device? 如何知道是否使用Pushsharp将推送通知传递到iOS应用程序? - How to Know whether Push Notification Delivered or not to an iOS app using Pushsharp? 如何通过PHP知道iOS推送通知的SSL证书何时过期 - How to know when SSL certificates are expires for iOS push notification by PHP 如何从iOS上的Firebase通知中知道“主题”名称 - How to know “topic” name from Firebase notification on iOS 如何知道iOS中的推送通知来自什么? - How to know what's coming from push notification in iOS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM