在用户点击它们之前在后台处理通知 - Swift 3

Handling notification in the background before user taps on them - Swift 3

在swift3中,如何在应用程序处于后台且用户点击通知之前处理本地通知?

UserNotificationController.userNotificationCenter(_:willPresent:withCompletionHandler:) 仅在用户点击通知时调用。

我的目标是创建一个本地通知,显示类似于来电的屏幕,用户可以在其中滑动以接听或挂断电话。

谢谢!

根据这个 SO 问题,这根本不可能:

引用link中给出的部分答案:

If your app was in the background or not running, and the user does not tap the notification and summon your app, you will get nothing at all and will have no way to know that the notification fired. This is because notifications are not for your benefit but are a way of sending a message to the user. (It sounds, from your question, as if you may be misusing local notifications as a way of sending a message to yourself. That is not what they are for.)