0
在我的應用程序中,用戶在HomeViewController中選擇A或B,然後在LocationViewController中,從tableview中選擇一個位置,最後,ResultViewController從其他用戶。當用戶點擊一個表格行時,如何將計數添加到Firebase數據
我被困在LocationViewController
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if userVote == "A" {
// add vote count by 1 to A of Location ABC in Firebase
// register this vote to user's path too
} else {
// add vote count by 1 to B of Location ABC in Firebase
// register this vote to user's path too
}
}
我是新來的iOS,斯威夫特和火力地堡註冊用戶選擇火力地堡,我好不容易纔走到這一步用this tutorial在AppCoda幫助。任何幫助表示讚賞:)
火力地堡有[大文件(https://www.firebase.com/docs/ios/)了。在這種情況下,您可能會查找['transaction()'](https://www.firebase.com/docs/ios/guide/saving-data.html#section-transactions),但最好是遵循快速入門,然後遵循編程指南。 –
謝謝弗蘭克!是的,我通過閱讀指南和使用交易():)解決了它。 – Thien
很酷。隨意自我回答,以便其他人可以從看到您的工作解決方案中受益。否則,我會投票結束太寬泛。 –