0
  1. Typical story... inherited a buggy app from a coder that left a year ago.
  2. App uses some funky transition plugins; namely, iCarousel, MPFFlipTransition.
  3. App pops separate browser tabs.
  4. Error is thrown when the browser or a browser tab is closed
  5. Somewhere an observer is getting leaked.
  6. I've added the following code to the class in question, with no luck:

    • (void)dealloc { // implement dealloc method/remove [[NSNotificationCenter defaultCenter] removeObserver:self]; }

How do I trace the app to find where this observer is being set? Can I observe specific memory locations? Can I somehow view the key/value pairs? Thx, Keith <3

Error thrown:

2014-10-03 12:33:20.938 myApp[5299:60b] An instance 0x145661f0 of class DesktopBrowserVC 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 0x14547300> (
<NSKeyValueObservance 0x14547210: Observer: 0x145550a0, Key path: title, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x14547320>
kmiklas
  • 13,085
  • 22
  • 67
  • 103
  • KVO is separate from the NSNotificationCenter. Do you see any places in your code where you add a KVO observer but don't have a subsequent `removeObserver` call (in dealloc or whatnot)? – Aaron Wojnowski Oct 03 '14 at 16:55

1 Answers1

0

You could easily find where any observers are added for that key path by searching your project (Cmd+Shift+F) for the string forKeyPath:@"title"

You can also investigate what observers are currently observing your any object at any time by calling the following method:

[NSObject observationInfo]

And as @AaronWojnowski said, make sure you're not confusing Key-Value Observers with NSNotificationCenter observers!

T Blank
  • 1,408
  • 1
  • 16
  • 21