錯誤提示:
Invalid update: invalid number of rows in section 0
詳細錯誤:
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Invalid update: invalid number of rows in section 6.
The number of rows contained in an existing section after the update (0) must be equal to the number of rows contained in that section before the update (9),
plus or minus the number of rows inserted or deleted from that section (0 inserted, 3 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
導致這個錯誤是因為要刪除一行數(shù)據(jù),但是呢,數(shù)據(jù)源沒改動,所以一定要在刪除行之前改變數(shù)據(jù)源。
PS:我出現(xiàn)此問題是因為,我的數(shù)據(jù)源是不可變數(shù)組,然后放到了可變數(shù)組中,操作可變數(shù)據(jù),但是數(shù)據(jù)源還是沒變,這樣刪除的時候就會出現(xiàn)這個錯誤。
出現(xiàn)這個錯誤,不會刷新走數(shù)據(jù)源代理,但是會檢查數(shù)據(jù)源。