I binded a fetchResultedController
to a context, that is reset
-ed.
Before it I have added a record to this context, and didChangeObject
was invoked with the .Insert
changeType
, but after reset
I was expect didChangeObject
will get called with .Delete
changeType
, but it does not happened.
Any idea how to trigger to receive a call with .Delete
argument?
If you look at NSFetchedResultsController documentation, there is a section about "Handling Object Invalidation" which states the following,
When a managed object context notifies the fetched results controller that individual objects are invalidated, the controller treats these as deleted objects and sends the proper delegate calls.
It’s possible for all the objects in a managed object context to be invalidated simultaneously. (For example, as a result of calling reset, or if a store is removed from the the persistent store coordinator.) When this happens, NSFetchedResultsController does not invalidate all objects, nor does it send individual notifications for object deletions. Instead, you must call performFetch: to reset the state of the controller then reload the data in the table view (reloadData).
As the doc says, if the context is reset or the context gets deallocated, none of the individual notification or delegation methods are called. So, it is your job to call performFetch by yourself and reaload the interface then.