Error with number of table rows in my project

I’ve been following tutorial for table view while building a Dream Journal App. After I added multiple selection and deleting I’m getting the following error when I try to edit my list items:

‘NSInternalInconsistencyException’, reason: ‘Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (1), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).’

I’ve compared the code with the solution but cannot find where I have error. I’ve just started using swift so I’ll be grateful for any help. I’ve pushed my project to github here: GitHub - Ania-chan/DreamJournal: My project for Polyglottal Week

Also because it’s a dream journal I need input longer than the current UITextField. Can I just change it to UITextView or is there a better way?

Thanks in advance!

Hi @ania-chan, welcome to the Ray Wenderlich forum! I tested out your app but was unable to reproduce the issue. I was able to create multiple posts (4), delete a post, delete all 4 posts when editing, and able to delete one post when editing. Please let us know if you are still having this issue so we can try to help you out.


Hi @gdelarosa! Thank you for your reply!
I might have wrote my question in a hard to understand way. I wrote functions for multiple editing but after that I cannot adit each entry any more when I click on the button with i in a circle.

Hi @ania-chan,
at first glance of the code, it seems that your delete function is getting out of sync with the UI rows


@jayantvarma Thanks for help and sorry for the late answer!

This topic was automatically closed after 166 days. New replies are no longer allowed.