【发布时间】:2018-08-23 18:47:28
【问题描述】:
基本上第一次运行它是完美的,然后它第二次崩溃。我有一些图片显示它崩溃的代码行。这个问题似乎与执行批处理有关。
代码:
let ref = Database.database().reference().child("test")
ref.observeSingleEvent(of: .value, with: { (snapshot) in
if let snapDict = snapshot.value as? [String:AnyObject] {
for snap in snapDict {
if snap.key == "testValue" {
self.log.performBatchUpdates({
let indexPath = IndexPath(row: group.count, section: 0)
group.append("textHere")
self.log.insertItems(at: [indexPath])
}, completion: nil)
}
}
【问题讨论】:
标签: ios swift firebase firebase-realtime-database uicollectionview