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

前端 未结 12 1669
情深已故
情深已故 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 15:50

    SWIFT 5.1

    UIApplication.State did not work for me, because once I read fingerprint (modal is shown) in my app, notification is also thrown in upper bar and user must click it.

    I've created

    public static var isNotificationFromApp: Bool = false

    in AppDelegate and I set it true in my starting viewController and then in my notification storyboard/viewControllerI just check that :)

    Hope it can come in handy

提交回复
热议问题