Re: Crash when loading NSViewController view with NSArrayController [solved]
Re: Crash when loading NSViewController view with NSArrayController [solved]
- Subject: Re: Crash when loading NSViewController view with NSArrayController [solved]
- From: Lee Ann Rucker <email@hidden>
- Date: Sun, 30 Sep 2012 10:57:29 -0700 (PDT)
Weird that you didn't get the warning, but we've switched to the pattern of
[self addObserver:self forKeyPath:@"ctrl.selectedObjects.someString"...
and that's saved countless headaches. You can remove your own observers in dealloc so you never need to worry about when to remove the observer.
--
[ctrl addObserver:self forKeyPath:@"selectedObjects.someString"
options:NSKeyValueObservingOptionNew context:kSomeContext];
but never removed the observer. This caused the crash.
What I don't know is why the runtime didn't manage to warn me about it.
Something like "Object deallocated while still observing key path xxx" or
"Controller being deallocated while an observer is still registered". I saw
those a couple of times, maybe it's because I was observing a proxy?
Anyway, after hunting this damn thing for a couple of days exclusively, I'm
really relieved that it's fixed.
Thanks a lot to you an Kyle for the suggestions!
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden