SwiftUI在更新包含复杂项目的List界面时,可能会导致App崩溃,且出现如下错误信息:
Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘UITableView internal inconsistency: encountered out of bounds global row index while preparing batch updates (oldRow=xx, oldGlobalRowCount=xx)’ terminating with uncaught exception of type NSException
为什么会出现这种问题?又该如何解决呢?
这个问题貌似很棘手,其实修复也很简单。
那还等什么呢?
Let’s dive in right now!
问题分析 1. 卢克,上源代码!为了更好的了解事情的全部真相,我们有必要先熟悉一下“案发现场”,从源代码看一下到底有什么问题:
enum