简体   繁体   中英

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM