【发布时间】:2016-11-29 01:59:44
【问题描述】:
这是我的观察事件代码:
let databaseRef = FIRDatabase.database().reference()
let query = databaseRef.child("palettes").queryOrdered(byChild: UserDefaults.standard.string(forKey: "UserTypeState")!).queryEqual(toValue: modifiedColor.hexValue())
// Change the value to the value of the color.
query.observe(.childAdded, with: { (snapshot) in
let URL = snapshot.childSnapshot(forPath: "URL").value as! String
self.URLArrayString.append(URL)
self.collectionView?.reloadData() //Reloads data after the number and all the URLs are fetched
self.noResultsLabel.isHidden = true
})
如何在调用特定观察者时检索句柄,以便在 viewDidDissapear 时将其删除?
【问题讨论】:
标签: swift firebase firebase-realtime-database