Reputation: 728
In core data, we're trying to determine the deltas in our one-to-one and one-to-many relationships since the last save event (either removed, added, or updated objects in the relationship). We've tried to use the NSMangagedObjectContext method updatedObjects, but it only ever returns information on the attributes changed, and no information on the relationships changed. We've searched the Apple documentation and other sources and considered writing custom Managed Object accessor methods, but saw that it was highly discouraged.
What is the best way to figure out the deltas in an NSManagedObject relationship?
Upvotes: 2
Views: 773
Reputation: 80265
updatedObjects
should return all objects in the object graph that have changes. You just need to make sure that:
registeredObjects
You can accomplish the last point e.g. by fetching all instances of the entity you are interested in.
Please note that you can also use the NSManagedObjectContextObjectsDidChangeNotification
to react to changes in the object graph.
Upvotes: 2