小编Pau*_*ina的帖子

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
查看次数

如何访问 Firestore 中查询文档的子集合?

上下文:以下是我在 Firebase Firestore 中的集合和文档的屏幕截图。基本上,每个交易文档都有自己的字段和其中的聊天集合。

我需要什么:我的目标是使用特定的 handler_id 查询文档并访问其中的聊天集合。

发生了什么:此查询仅返回交易字段

 db.collection("transaction").where("handler_id", "==", 3)
Run Code Online (Sandbox Code Playgroud)

如何在查询的文档中包含聊天集合?您对我如何更有效地构建数据有什么建议吗? 在此处输入图片说明

javascript firebase google-cloud-firestore

4
推荐指数
1
解决办法
1001
查看次数