【发布时间】:2016-09-05 10:10:47
【问题描述】:
我目前正在学习 Firebase 和 iOS,所以请多多包涵。我目前正在向名为Posts 的表发帖,如下所示:
let postInfo = ["Description": txtPostDescription.text!, "ImageUrl": imgUrl, "Likes": 0]
var t = FIRDatabase.database().reference().child("Posts").childByAutoId().setValue(postInfo)
print(t)
我正在尝试检索插入新记录时创建的primary key,但是我无法检索它。我试过childByAutoId()(但由于浏览网页而无法找到可靠的解决方案,这是一个随机猜测)。有什么想法吗?
【问题讨论】:
标签: ios swift firebase firebase-realtime-database