相关疑难解决方法(0)

Swiftui:当用户单击推送通知时,如何导航到特定的 NavigationLink?

我正在将 FCM 与我的 ios 推送通知一起使用。当用户点击推送通知时,如何导航到特定的导航链接。预先感谢您的帮助!

我了解我将处理此功能上的推送通知点击。

    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfo
        // Print message ID.
        if let messageID = userInfo[gcmMessageIDKey] {
            print("Message ID userNotificationCenterdidReceive response: \(messageID)")
        }
        // Print full message.
        print(userInfo)

        let application = UIApplication.shared

        if(application.applicationState == .active){
          print("user tapped the notification bar when the app is in foreground")
        }
        if(application.applicationState == .inactive)
        {
          print("user tapped the notification bar when the app is in background")
        } …
Run Code Online (Sandbox Code Playgroud)

push-notification firebase-cloud-messaging swiftui

6
推荐指数
1
解决办法
1645
查看次数