Leaking observers


#1

Hi,
I’m working through the chapter and I noticed that if I open the image library, then dismiss, then open again via the button, I get:

2011-07-19 16:08:21.085 Homepwner[3041:207] An instance 0x6a56930 of class PLManagedAlbum_Album_ 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 0x6a4d5c0> ( <NSKeyValueObservance 0x6a5a1d0: Observer: 0x6a51fe0, Key path: assets, Options: <New: NO, Old: NO, Prior: YES> Context: 0xb8c8740, Property: 0x6a58c60>

I’m going to hazard a guess that this is because of the UIImagePicker is released but the delegate is not set to nil? Is this the case, or is it something entirely different?

Great book, by the way!

Thanks in advance


#2

This actually sounds like an iOS bug: since you never created an instance of PLManagedAlbum_Album_ and definitely did not attach any KVOs to it. (Delegation and KVO are different topics, KVO just lets you “watch” and instance variable of some object and get sent a message any time it changes.)