objective c - How do I tell a (managed) object to notify its KVOs that one of its properties needs to be recached? -
When we have generated on the basis of an object property other properties that we generally apply + KeyPathsForValuesAffecting {PropertyName} class method
What I'm trying to do is basically the same thing for a property on my NSManagedObject, but traversing a relationship is there.
My model is simple; I have two entities, app version (I made a Aepakast-generating app) when I do app are changed properties, because I carry out the above method, is -appcast changed string, and fair to all bindings Is updated from
However, the versions of a particular app (Kisi- many relationships) changes, -appcast property is not properly generated I could Haj Fix / Warcoround?
This is a bit of late reply, but I think it's a common situation, and definite The answer is obviously not clear.
I generally see to change the managed object contact and then check that any objects have changed which I want to see. So, in your NSManagedObject Subclass:
// We can then register for notification in both awakeFromFetch // and awakeFromInsert or that one, but depending on the // object was first created or otherwise need to - (minus) awakeFromFetch {[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector (managedObjectContextDidChange :) name: NSManagedObjectContextObjectsDidChangeNotification object: [self managedObjectContext]]; } - (void) awakeFromInsert {[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector (managedObjectContextDidChange :) Name: NSManagedObjectContextObjectsDidChangeNotification object: [self managedObjectContext]]; } - (void) managedObjectContextDidChange: (NSNotification *) received a set which notification has been given {// everything changed NSSet * insertedObjects = [[Notification userInfo objectForKey]: NSInsertedObjectsKey]; NSSet * Update Objects = [[Information User Efo] Object Faroeqi: NSUttified Objects]; NSSet * Deleted Objects = [[Information User Efo] ObjectForekey: NSDiated Objects]; NSSet * Replaced Objects = [Excluded Object SetBabingAbject FrameSet: Update Objects]; Changed object = [changed object set sized objects set to form: deleted object]; If ([convert objects to change each other: [Self version]]) {[self Will Chenjvaluforः: @ "Aepakast"]; [Own Kiachenjwalleforki: @ "Aepakast"]; }}
certainly is not ideal from a performance perspective, because this information is something every once in your object graph changes the fire, but I do it to the direct completion way.
Comments
Post a Comment