【发布时间】:2017-04-26 01:12:20
【问题描述】:
我无法弄清楚如何通过 IBAction 将数据写入我的 Firebase 数据库。
我的问题是无法写入实际数据库,这是正在写入的数据类型。
我需要使用 Google Maps Services Place 对象写入数据。这是我的数据库编写代码:
let newWaitTime = Int(waitTimeLabel.text!)
let waitTime = databaseRef.child("times").child(place.placeID).childByAutoId()
waitTime.setValue(newWaitTime)
问题是因为IBAction 函数不能接受其他参数,我不能将我的place 变量传递到函数中以允许我写入我的数据库。
我似乎无法找到解决方法,因为它需要知道place.placeID 才能提交时间。没有它,就无法区分哪个时间属于哪个地方。有什么想法吗?
【问题讨论】:
标签: ios swift firebase firebase-realtime-database gmsplace