【发布时间】:2020-11-26 15:13:43
【问题描述】:
我正在使用 UserNotifications 处理 iOS 应用程序。
当用户点击通知时,会触发此方法:
userNotificationCenter(_:didReceive:withCompletionHandler:)
我想知道当通知到达时是否有一个方法被调用,与用户何时反应无关。
【问题讨论】:
标签: ios swift usernotifications
我正在使用 UserNotifications 处理 iOS 应用程序。
当用户点击通知时,会触发此方法:
userNotificationCenter(_:didReceive:withCompletionHandler:)
我想知道当通知到达时是否有一个方法被调用,与用户何时反应无关。
【问题讨论】:
标签: ios swift usernotifications
是的,你可以:https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649518-usernotificationcenter 当然,应用程序必须为此打开。如果应用程序关闭,您将无法执行代码。 在某些情况下,如果应用处于后台但需要特殊授权,您可以执行代码。
【讨论】: