Thread 1: "Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (15) must be equal to the number of rows contained in that section before the update (15), plus or minus the number of row
Putting the code tableView.deleteRows(at: [indexPath], with: .fade) in front will report the above error
correct code
modelArr.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
When deleting rows, the tableview will go through numberOfRowsInSection again. If the data is not deleted in the data source, the number of data will not match the number of rows and the program will crash.
Reference blog:
iOS-bug record, Thread 1: "Invalid update: invalid number of rows in section 0. xxxxx - csdn