Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 426383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:28:26+00:00 2026-05-12T19:28:26+00:00

I’ve come across this issue in my application, and have reproduced it using Apple’s

  • 0

I’ve come across this issue in my application, and have reproduced it using Apple’s CoreDataBooks codebase with 0 modifications to the code. The problem is if you make an edit to a managed object, and save the context, with the result being a section with only one row now having no rows, and a new section created with the resulting object added to it, then you get the invalid update exception. It also seems to depend on the ordering of the rows.

To recreate follow these steps:

  1. Open a new instance of CoreDataBooks example
  2. Edit Richard Dawkins book, “The Selfish Gene” and change the author to Ben. Save it. If you return to the main view you’ll notice that the book is under a new section named Ben.
  3. Edit this book again, and change the author to Doug. Save it. You’ll get the following exception:

    2009-10-01 15:14:29.050 CoreDataBooks[10898:20b] *** Assertion failure in -[UITableView_endCellAnimationsWithContext:], /SourceCache/UIKit/UIKit-963.10/UITableView.m:729 2009-10-01 15:14:29.051 CoreDataBooks[10898:20b] Serious application error.  Exception was caught during Core Data change processing: Invalid update: invalid number of rows in section 1.  The number of rows contained in an existing section after the update (2) must be equal to the number of rows contained in that section before the update (2), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted). with userInfo (null)
    

I’d post the code from my own app to make sure I’m not missing any required delegate methods, except as the example above shows it’s an issue which affects Apple’s CoreDataBooks example straight off the shelf. The NSFetchedResultsController delegate methods are all implemented as per their own examples. Their code doesn’t seem to forget to handle newly created sections either, as it works in other cases with different section orderings.

Any help would be appreciated. Example modified code from the CoreDataBooks example would be great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:28:26+00:00Added an answer on May 12, 2026 at 7:28 pm

    The way to fix this seems to be to change these lines in the table updates section of the RootViewController:

        case NSFetchedResultsChangeMove:
      [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    
      // Reloading the section inserts a new row and ensures that titles are updated appropriately.
      [tableView reloadSections:[NSIndexSet indexSetWithIndex:newIndexPath.section] withRowAnimation:UITableViewRowAnimationFade];
       break;
    

    to:

             case NSFetchedResultsChangeMove:
          [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
          [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
          break;
    

    for some reason. The problem seems to come from deleting the last row in a section; it appears that unless you add the extra insertRows, the UITableView freaks out over the fact that the section which has been deleted suddenly gains a whole bunch of extra rows.

    Took me hours to figure that one out….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
this is what i have right now Drawing an RSS feed into the php,
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.