Cannot remove an observer?


#1

I’ve made the changes to RMDocument.h, .m, and .xib as specified in the book, but when I click “Remove” in the sheet I get this:

2014-06-14 14:43:53.573 RaiseMan[2160:303] Alert sheet ended 2014-06-14 14:43:53.574 RaiseMan[2160:303] removing <Person: 0x628000221bc0> from ( "<Person: 0x628000221bc0>" ) 2014-06-14 14:43:53.574 RaiseMan[2160:303] Cannot remove an observer <RMDocument 0x6280000eab80> for the key path "expectedRaise" from <Person 0x628000221bc0> because it is not registered as an observer.

I’ve compared the changes I made in chapter 15 to the example code and don’t see any difference, except that the example project for chapter 15 works fine.

The error about “cannot remove observer” is almost certainly telling me where the problem is, except that I can’t understand what it’s telling me. The observeValueForKeyPath:ofObject:change:context: method seemed like a good place to look, but I didn’t see any difference between my version and the example code there either.


#2

I finally figured this out. There was a typo in my startObservingPerson: method–I was adding an observer forKeyPath:@“expectedRaide” when it should have been forKeyPath:@“expectedRaise”. That was impressively hard to track down.