Objective C:Object Deallocated while key value observers were still registered with it
Solution 1
To set the breakpoint open the breakpoints tab in Xcode 4 (Breakpoints window in Xcode 3) and add a new symbolic Breakpoint for the symbol "NSKVODeallocateBreak"
Use the debugger console to print the observer at the adress given in the observation info
Observer: 0x19af20
po 0x19af20
This should give some valuable information about the observer. Override addObserver:forKeyPath:options:context: in your custom CarPark class and set a breakpoint to see the exact location of the observing being established.
Solution 2
It's probably due to the observer being deallocated before the objects being observed. You would need to implement the -(void) dealloc method to remove all observed objects in the observer.
Related videos on Youtube
Zhen
Updated on May 31, 2022Comments
-
Zhen about 2 years
I am hitting the below error after I added 2 additional fields to my core data model.
CarPark_CarPark_ 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: <NSKeyValueObservationInfo 0x1b6510> ( <NSKeyValueObservance 0x19b210: Observer: 0x1a8cf0, Key path: coordinate, Options: <New: NO, Old: NO, Prior: YES> Context: 0x0, Property: 0x1b7e00> )
I am a little lost on what to do next. Any guidance on this will be greatly greatly appreciated! Please let me know what other information is required.
-
omz about 13 yearsHave you followed the recommendation to set a breakpoint on NSKVODeallocateBreak? That could help you to figure out where the problem comes from.
-
Zhen about 13 yearsI didn't set any oberservers in my application. But what does this actually mean? "Here's the current observation info: <NSKeyValueObservationInfo 0x1ac3a0> ( <NSKeyValueObservance 0x1ac360: Observer: 0x19af20, Key path: coordinate, Options: <New: NO, Old: NO, Prior: YES> Context: 0x0, Property: 0x1ac3e0>"
-
-
HotJard almost 11 yearsfantastic! Great way to find leaking