jpsim / JPSVolumeButtonHandler

JPSVolumeButtonHandler provides an easy block interface to hardware volume buttons on iOS devices. Perfect for camera apps!
MIT License
333 stars 90 forks source link

Safely Remove Observer #11

Open mattyohe opened 9 years ago

mattyohe commented 9 years ago

Had an old version of your code in our app and there was a crasher due to over-removing the sessionVolumeKeyPath in dealloc. I'm not sure what scenario led to the observer not properly being added.

I would recommend wrapping this line: https://github.com/jpsim/JPSVolumeButtonHandler/blob/master/JPSVolumeButtonHandler/JPSVolumeButtonHandler.m#L47

in an empty @try so that this no longer crashes in odd scenarios.

underscoretang commented 9 years ago

hey @mattyohe did this ever get resolved for you?

mattyohe commented 9 years ago

@underscoretang Sure, I just did exactly what I said in the comment above. Is that not clear? Let me know.