According to Apple and numerous examples I've seen, there is no problem using KVO/KVC to observer yourself. Also according to those same sources, it's not a problem setting this up by using addObserver:forKeypath:options:context: in an object's init method, a la:
- (id)init
{
self = [super init];
if (self) {
[self addObserver:self
forKeyPath:@"selected"
options:NSKeyValueObservingOptionNew
context:NULL];
}
return self;
}
Unfortunately for some reason, my observer method does not get called when I do it there. If I move the addObserver call to another method and then invoke that method in the calling method:
MyObject *newObj = [[MyObject alloc] init];
[newObj setupObservers];
Then all is fine. This is a subclass of NSImageView, so it's not like there's any 'awakeFromNib'-type alternative here... I'm really scratching my head here and I'm sure I'm missing something obvious - like a rule about things which will cause KVO on self to not work in init methods, but I haven't found anything in the docs which would give me any hints here.
What do I not know?