I am trying to track object changes in the context of master data by tracking the name of the changed properties along with old and new values.
I registered for NSManagedObjectContextWillSaveNotificationto be notified when a save will occur, and can pull inserted / updated / deleted objects out of context ... Then I can see the changed values ββusing .changedValues.
However, I am having difficulty retrieving old values ββ...
As an example, I have an object that tracks a position, and so one of the changes is returned:
po [obj changedValues]
{
originX = 260;
originY = 180;
}
This gives me new values ββfor properties that have been changed on the object. To try to get the old values, I use changedValuesForCurrentEventwhich, according to the docs, should return
"a dictionary containing keys and old values ββof constant properties that have changed since the last publication NSManagedObjectContextObjectsDidChangeNotification"
However, when I try to do this, it returns empty ...:
po [obj changedValuesForCurrentEvent]
{
}
How can I capture old and new values?
source
share