如何确定用户是否使用默认查看按钮在锁定屏幕上查看通知

时间:2018-12-24 12:47:37

标签: ios push-notification notifications apple-push-notifications swift4

我一直在使用Rich Push Notifications(IOS)

,并想知道有什么方法可以确定用户是否默认通过查看按钮在锁定屏幕上查看通知

1 个答案:

答案 0 :(得分:0)

您不知道用户是否“查看”了应用外部的通知,但您还可以了解其他一些信息:

  • 如果通知已发送
  • 如果是通过电话收到的
  • 如果用户点击了通知

可以通过以下方法在AppDelegate中跟踪第二和第三项:

func userNotificationCenter(_ center: UNUserNotificationCenter,
                            didReceive response: UNNotificationResponse,
                            withCompletionHandler completionHandler: @escaping() -> Void) {