17

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.

Ajith Renjala
  • 4,934
  • 5
  • 34
  • 42
Zhen
  • 12,361
  • 38
  • 122
  • 199
  • Have you followed the recommendation to set a breakpoint on NSKVODeallocateBreak? That could help you to figure out where the problem comes from. – omz May 12 '11 at 19:56
  • @omz, pardon my ignorance, how can I set this breakpoint on NSKVODeallocateBreak? – Zhen May 13 '11 at 01:55
  • I didn't set any oberservers in my application. But what does this actually mean? "Here's the current observation info: ( Context: 0x0, Property: 0x1ac3e0>" – Zhen May 13 '11 at 04:26

2 Answers2

28

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.

Martin Brugger
  • 3,168
  • 26
  • 20
9

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.

maarut
  • 91
  • 1
  • 1