Ios FirebaseUI表视图与';无效更新:节0中的行数无效
我在一个选项卡控制器中有3个表视图,它们都是这样填充的:Ios FirebaseUI表视图与';无效更新:节0中的行数无效,ios,swift,firebase,firebase-realtime-database,firebaseui,Ios,Swift,Firebase,Firebase Realtime Database,Firebaseui,我在一个选项卡控制器中有3个表视图,它们都是这样填充的: override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.dataSource = self.notesTableView.bind(to: getQuery()) { tableView, indexPath, snap in let cell = self.notesTableView.d
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.dataSource = self.notesTableView.bind(to: getQuery()) { tableView, indexPath, snap in
let cell = self.notesTableView.dequeueReusableCell(withIdentifier: "cellident", for: indexPath)
let customCell = cell as! TextCell
self.notesTableView.dataSource = self.dataSource
self.notesTableView.delegate = self
if let note = snap.childSnapshot(forPath: "note").value as! String? {
customCell.notesLabel.text = note
} else {
customCell.notesLabel.text = "Undefined"
}
return cell
}
}
当我在手机上运行应用程序并在选项卡之间切换时,经过一段时间后,我总是遇到以下异常:
“NSInternalInconsistencyException”,原因:“无效更新:节0中的行数无效
此外,控制台显示了这一点,但我不确定如何解释这一点:
***在-[UITableView\u endCellAnimationsWithContext:],/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3600.7.47/UITableView.m:1737中断言失败
我的问题是,是否有人知道FirebaseUI异常的原因可能是什么。我的猜测是,这与填充表格有关。在
视图中将消失
设置self.dataSource=nil
这样,您就不会不正确地更新数据源了
从这个问题
根据我的经验,最安全的方法是在视图中将消失设置self.dataSource.unbind()
您的表格视图(uuuuU2;:numberOfRowsInSection:)
方法的内容看起来像什么?@Toddkerman我没有这个方法。我认为FirebaseUI库应该涵盖这一点。