ViewContext not receiving updates from newBackgroundContext()
"I can’t use NSFetchResultController
as I use a custom view to represent the data" not true, the FRC can and should be used with any view (that shows multiple objects).
As for why you are not receiving the NSManagedObjectContextObjectsDidChange
in the case of updates (which come in as refreshed) or deletes I have a few theories:
Maybe not properly called
_persistentContainer.viewContext.automaticallyMergesChangesFromParent = YES;
because that causes exactly the situation you describe (receiving inserts but not updates or deletes). It should be done in the persistentContainer custom getter in your app delegate afterloadPersistentStoresWithCompletionHandler
(and not inside the block).Perhaps not using
performBlock
with your background context.Possibly not registered for the did change notification correctly.
(In light of new information) Not retaining the fetched objects.
If you would like to share some code we can help you track down the bug.