NSManagedObject: isUpdated and changedValues ​​mismatch

I have a Core Data entity class that subclasses NSManagedObject.

I want to update the entity attribute with the latest modif. timestamp, so I will implement its willSave method.

I found out that calling isUpdated returns TRUE, but changedValues empty (the same for changedValuesForCurrentEvent ).

Can you explain to me how this is possible?

thanks

+4
source share
1 answer

The isUpdated state isUpdated set to YES when any property that triggers KVO notifications is updated, so redefining the property to the current value will cause the isUpdated value isUpdated be set to YES .

changedValues returns properties that were actually changed. Perhaps this category method will help:

 - (BOOL) isActuallyUpdated { return self.changedValues.count > 0 } 
+2
source

All Articles