[英]Swift UILocalNotification: Is it possible to fire an event when Notification is displayed?
So I know the didReceiveLocalNotification event is fired when a user selects an action on a Local Notification. 因此,我知道当用户在本地通知上选择一个动作时,就会触发didReceiveLocalNotification事件。
But, is an event fired prior to that when the notification is displayed as a banner or alert when the app is not active? 但是,当通知显示为横幅广告或应用程序不活动时,是否在此事件之前触发了事件? And can that be accessed to do some background code?
可以访问它做一些后台代码吗?
I am looking for an answer in Swift if you can help. 如果您需要帮助,我正在Swift中寻找答案。
No, local notifications do not and cannot awake the app when firing and the application is not active. 不可以,在启动且应用程序未激活时,本地通知不会且无法唤醒应用程序。 The user must tap the notification, or perform a developer defined action on it before the app hears anything.
用户必须点击通知,或在应用程序听到任何声音之前对其执行开发人员定义的操作。
If you need your app to wake up, you need to use a remote notification with content available flag set. 如果您需要唤醒应用程序,则需要使用设置了内容可用标志的远程通知。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.