ios - 如何向 firebase 中的现有节点插入新值?

标签 ios firebase swift3 firebase-realtime-database

我对如何将新值插入到 firebase 中的现有节点中感到非常困惑?

如下图所示,当我尝试上传 Route 对象时,我也希望 uploadedRoute 可以输入 Route 对象的键。我尝试过使用 setValue,但它会删除旧值,我想要的是类似“添加” key ,但我真的不知道,有人可以给我提示吗?

最佳答案

这是您想要的结构吗?

enter image description here

如果是这样,您可以尝试以下方法:

dataRef.child("data/users/\(userID)/Routes/uploadedRoutes/\(routeID)").updateChildValues(["isUploaded": true])

关于ios - 如何向 firebase 中的现有节点插入新值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43498739/

相关文章:

ios - 是否有一个特定的组件可以与 Swift 3 一起使用来表示 "ComboBox/Spinner"?

ios - UISegmentedControl 以编程方式

ios - Objective C Maths 没有返回正确的值

javascript - 在 Firebase 中过滤数据

android - 当新消息发送给用户并且应用程序处于后台时,我没有收到推送通知

swift - runTransactionBlock currentData 为空

ios - 如何设置iOS WkWebview缩放比例

ios - 带有三个点的 UITextview 剪辑?

ios - NSDecimalNumber(string:“。”)返回0(零)。为什么?

ios - UIView 中的径向渐变颜色未更新