Запуск приложения, использующего просмотр таблицы, сбой симуляторов при запуске, с:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempted to call -cellForRowAtIndexPath: on the table view while it was in the process of updating its visible cells, which is not allowed.
Тот же код работал в iOS 12 / Xcode 10.2.
Комментирование выделенной функциивызов ниже решил проблему сбоя:
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
updateRowHeight(indexPath: indexPath) // CRASH IS BECAUSE OF CALLING THIS HERE
return myTableView.frame.height / CGFloat(CellsDataEnum.allCases.count)
}
func updateRowHeight(indexPath: IndexPath) { // WHICH CALLS THIS
myTableView.cellForRow(at: indexPath)?.textLabel?.font = UIFont.systemFont(ofSize: myTableView.frame.height / 10)
}
Вместо этого я теперь установил шрифт в cellForRowAt
:
cell.textLabel?.font = UIFont.systemFont(ofSize: myTableView.frame.height / 10)
Почему первая версия работала в iOS 12, но сбой в iOS13