In a table, I have 3 indexes which calls each a function. In each function, there is an add button that adds data into CoreData. First 2 works, but when i press the 3rd inde
The error message tells you the problem:
Invalid update: invalid number of rows in section 0. 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 (0), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted). with userInfo (null)**
In your table section (0), you started with zero rows i.e. an empty section. Then you added 1 row so the section(0) row count should be 1 but numberOfRowsInSection:
is returning zero.
There are three probable causes for this problem:
beginUpdate
in controllerWillChangeContent:
such that the tableview tries to redraw itself before the update completes.numberOfRowsInSection
returns the wrong row count for the section.Can't tell you the actual problem without the code.