tags:

views:

23

answers:

1

I have a class that acts as a NSFetchedResultsControllerDelegate which is receiving messages to -(void)controller:didChangeObject:atIndexPath:forChangeType:newIndexPath: with change type NSFetchedResultsChangeInsert, but the actual object which is the subject has with certainty not been newly inserted, only updated. So I would expect to get a change message with type NSFetchedResultsChangeUpdate, should I not?

If i check the value of isInserted on the object, it yields false (as expected from the logic in my program). So my question is, why is this reported as an insert when it is only a change/update?

They only thing I can think of is that part of the changes that are taking place is that objects of another entity type are inserted with relationships to objects of the entity type that the NSFetchedResultsController is set up to fetch.

A: 

Because the call to the delegate occurs after the save which at that point the object is no longer in a isInserted state. It is now successfully saved and the insert is finished.

-isInserted returns YES when the object is newly inserted but not yet saved.

Marcus S. Zarra