【发布时间】:2016-04-27 06:11:15
【问题描述】:
我有一个问题,我正在尝试访问 firebase 上的一些数据,这是数据结构
我设法访问了“收藏夹” 这是我以前得到的
ref.observeEventType(.Value, withBlock: { snapshot in
let fav = snapshot.value.objectForKey("favPost")
print("\(fav) Printed")
})
但我正在尝试访问“favPost”但我无法弄清楚?!!
Firebase 结构
{
"posts" : {
"-KGIxJybfQEJbcSy2bHH" : {
"author" : "Rioodi",
"postText" : "Test",
"votes" : 1
},
"-KGIxLUmPIa1Q1k0oRLs" : {
"author" : "Rioodi",
"postText" : "Raed",
"votes" : 0
},
"-KGJe-5ciAyu6Kom98E0" : {
"author" : "Neal",
"postText" : "Neal",
"votes" : 0
},
"-KGLFC0RqW_48lHMCsx8" : {
"author" : "Rioodi",
"postText" : "Test",
"votes" : 0
}
},
"users" : {
"afd0f27a-f62f-4cf1-9e81-032edc246687" : {
"email" : "test@test.com",
"favorite" : {
"-KGIxJybfQEJbcSy2bHH" : {
"favPost" : "Test"
}
},
"provider" : "password",
"username" : "Rioodi"
},
"fc56cc22-6275-48e0-8376-0b73b273b8e2" : {
"email" : "tests@test.com",
"provider" : "password",
"username" : "Neal"
}
}
}
【问题讨论】:
-
请将您的 Firebase 结构发布为文本!您可以使用 Firebase 仪表板中的“导出”按钮轻松获取。
-
好的,我发布了 firebase 结构