Say you have a core data entity,
public class CDPerson: NSManagedObject
You get new info from the net ... a field changes,
p.name = 'Debbie'
That CDPerson
item is "touched" and hence,
your NSFetchedResultsController will trigger,
perfect.
But say CDPerson
can belong to CDAddress
In core data, a change in CDAddress
does not trigger a change in CDPerson
But. When an address is touched, you DO want to touch the relevant person items,
so that results controllers will know CDPerson
has been changed.
How to "touch" a cd entity?
One rubbish solution, assuming you have an unimportant field,
let touch = p.creationDate
p.creationDate = touch
Alternately you could add an Int64 and
p.touchyInt = a random number, or increment, etc
These are poor solutions
Is there actually a way to "touch" a core data entity, for results controllers?
This seems to be critical in propagating changes in related entities.
It's hard to believe there is no solution for this.
PS related QA: NSFetchedResultsController with relationship not updating
"NSFetchedResultsController with relationship not updating"