[英]Swift iOS system notification dismiss calback
Question: Is there a way to detect if you get a system notification and you swipe away the notification banner (eg the alarm that triggers a system notification)?问题:有没有办法检测您是否收到系统通知并滑动通知横幅(例如触发系统通知的警报)?
More practical example: In your app, you are doing some stuff and suddenly you get a notification from another app.更实际的例子:在你的应用程序中,你正在做一些事情,突然你收到来自另一个应用程序的通知。 Instead of tapping on the notification, you swipe up the notification (you dismiss it that way).您不是点击通知,而是向上滑动通知(您以这种方式关闭它)。 After doing that, I want to capture that in the app.这样做之后,我想在应用程序中捕获它。
Why: Currently, I have a bug in the app, so if I can capture this action, I would be able to fix this bug.为什么:目前,我在应用程序中有一个错误,所以如果我能捕捉到这个动作,我就能够修复这个错误。
Thanks in advance!提前致谢!
When notification appears, the willResignActiveNotification
won't get called, therefore willEnterForegroundNotification
won't get called, too.当通知出现时, willResignActiveNotification
不会被调用,因此willEnterForegroundNotification
也不会被调用。 The best solution here is to catch incoming notification and show the custom view describing this notification instead of system one.这里最好的解决方案是捕获传入的通知并显示描述此通知的自定义视图而不是系统通知。 Thus, you can detect all actions/timings you need.因此,您可以检测您需要的所有动作/时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.