iOS push notification: how to detect if the user tapped on notification when the app is in background?

前端 未结 12 1687
情深已故
情深已故 2020-11-29 15:43

There are a lot of stackoverflow threads regarding this topic, but I still didn\'t find a good solution.

If the app is not in the background, I can check launc

12条回答
  •  青春惊慌失措
    2020-11-29 16:14

    In my case, background mode OFF did not make any difference. However when the app was suspended and the user tapped the notification, I could handle the case in this callback method:

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

提交回复
热议问题