Setting breakpoint at NSKVODeallocateBreak
iphone, lldb, mkmapview, xcode
Solution
You are probably doing something like this in your code:
`[addressAnnotation addObserver:self forKeyPath:kSelectedAnnotationObserverKeyPath options:NSKeyValueObservingOptionNew context:@"selectedOrDeselected"];`
That means that you are registering an observer to find out when an annotation has been selected.
You should remove the observer when the annotation gets removed from the map, like this:
`[addressAnnotation removeObserver:self forKeyPath:kSelectedAnnotationObserverKeyPath];`
That should remove the error. If it doesn't and you want to debug it, you certainly should set a breakpoint on `NSKVODeallocateBreak`. In order to do this, open the `Run` menu, `Manage Breakpoints`, `Add symbolic breakpoint`, enter `NSKVODeallocateBreak` and there you are.
Hope it helps!
Problem
I am playing around with the map kit and I created an annotation. I am trying to find my bug due to this error: An instance 0x1b7ac0 of class AddressAnnotation was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info: I'm not sure where that NSKVODeallocateBreak to set a breakpoint at is. I thought I could use Instruments to debug it, but when I try, it crashes without giving me any indication to where it crashed. Any thoughts?