16 Replies
      Latest reply: Aug 18, 2016 1:22 AM by hhartz RSS
      Level 1 Level 1 (0 points)

        I have an app where I have a FRC over a set of objects. If I update an object being "watched" by FRC, I'm getting an update notification AND an insert notification (for that object) in NSFetchedResultsControllerDelegate (didChangeObject). Because of this, core data asserts:

         

        *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit/UIKit-3347.44.2/UITableView.m:1623
        2015-07-20 23:55:26.623 mailapp[2432:2452516] CoreData: error: Serious application error.  An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:.  Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (7) must be equal to the number of rows contained in that section before the update (7), plus or minus the number of rows inserted or deleted from that section (2 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out). with userInfo (null)
        
        

         

        I cannot figure out why I'm getting the extra insert. I tried overriding my model's "awakeFromInsert" - that is never hit. I've verified that only when I change a property on the model does the update and insert notification fire. I can insert and delete objects fine.

         

        Update: In addition to FRC, I also subscribed to the NSManagedObjectContextObjectsDidChangeNotification event and from that event I only get one update, as expected. Why is FRC doing something funny?

         

        Any ideas?