Set a lastModificationDate attribute after NSManagedObjectsDidChangeNotification creates an infinite loop
问题 I added a lastModifiedDate attribute to all my entities to avoid duplicates when syncing the UIManagedDocument with iCloud, something that I found it can happen if I create new entities with an offline device (iPad) and, at the same time, I create the same entities using another online device (iPhone). I wanted to set this attribute whenever an object changes so I subscribed for NSManagedObjectContextObjectsDidChangeNotification . The code I wrote to set the lastModifiedDate creates an