【发布时间】:2019-10-13 03:18:23
【问题描述】:
这是我的数据结构:
问题是我不知道如何正确恢复也是 Key 的数据。我想要的只是键和值“true”只是标记。而且我什至不知道我当前存储的是什么类型的数据以及如何将键值恢复。
我想要这个:
["BAFS", "Econ", "Geog"]
以下是我写数据的方式:
var subjectvalue: [String] = []
let structure = subjectvalue.reduce(into:[String:String](), { $0[$1] = "true"})
let postRef = Database.database().reference().child("posts").child(id!).child("posts").setValue(structure)
我已经囤了几天了。有人有想法可以帮忙吗?提前谢谢你。
【问题讨论】:
-
要从字典中获取键,请参阅stackoverflow.com/questions/26386093/…
标签: swift firebase firebase-realtime-database