observeValueForKeyPath not being called

iphone, key-value-observing

Solution

Solved it: I was setting patrocinioDidLoad in logoAnimation directly, without using standard getters and setters. In logoAnimation,

patrocinioDidLoad = YES;

didn't work, whereas

self.patrocinioDidLoad = YES;

did!

Problem

I have a ViewController creating an instance of a UIView, and then I register an observer with the instance, such that ``` logoAnimation = [[MainLogoAnimation alloc] init]; [logoAnimation addObserver:self forKeyPath:@"patrocinioDidLoad" options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld) context:nil]; ``` then, in the same file, I have: ``` - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { NSLog(@"%@ \n %@ \n %@ \n ",keyPath,object,change); } ``` But, although I have checked and double-checked that logoAnimation.patrocinioDidLoad has changed, observeValueForKeyPath never gets called... Am I missing something? Thanks for the help! Antonio

Original source