I've been working with notifications for quite a while now, and I could've sworn that userNotificationCenter(_:didReceive:withCompletionHandler:) used to only be processed if the app was opened via the notification.
However, upon looking into actionable notifications, I found this:
When the user selects an action, the system launches your app in the background and notifies the shared
UNUserNotificationCenterobject, which notifies its delegate. Use your delegate object'suserNotificationCenter(_:didReceive:withCompletionHandler:)method to identify the selected action and provide an appropriate response.
Does this mean that the seemingly universal didReceive delegate method now works even while the device is locked?
Or must the app always be opened to actually do anything meaningful in response to notification actions (writing to local database, sending HTTPS requests, etc.)?


Yes, the delegate works even if the device is locked. The app is only woken up if the user chose an action. Also, I am not sure how much time you will get before you invoke the completion block.