Skip navigation.
 
mlKey value observing NSManagedObjects
FROM : Martin
DATE : Thu Feb 21 20:49:58 2008

Hi,

I'd like to key-value observe a property of an NSManagedObject. I 
tried to register an observer (in the init: method of my app's 
controller) using "addObserver:forKeyPath:options:" but it doesn't 
work because the observation is lost as my object gets dealloc'ed soon 
after I register as an observer. This is specified in the Core Data 
documentation : "Core Data "owns" the life-cycle of managed objects. 
[...] managed objects can be instantiated, destroyed, and resurrected 
by the framework as it requires."

So how can I observe a Core Data object property and how can the 
observation survive the multiple instantiations/desctructions of the 
NSManagedObject?

Thanks,
-Martin.

Related mailsAuthorDate
mlKey value observing NSManagedObjects Martin Feb 21, 20:49
mlre: Key value observing NSManagedObjects Ben Trumbull Feb 21, 22:43