user5465320 user5465320 - 9 months ago 65
iOS Question

How to use 'userInteractionEnabled' property in iOS

I use a property (the name is 'userInteractionEnabled') to change navigationController.navigationBar's state , but Xcode throw Error ,

Please look this image :
enter image description here

your can see this code , when the App invoke [self viewDidDisappear:] method that Xcode throw Error .
Error message : EXC_BAD_ACCESS(code=2,address=0x7fff5bc8bfb8)

Can your please me?
why Xcode throw error ?
why throw EXC_BAD_ACCESS ?
Why ?


You have a recursion problem. You are modifying the observed property at the time you are handling the observation of the previous change to the property.

Look at the stack trace. It's stuck calling the observer over and over as each observation changes the property again.

Don't change an observed property directly in the observeValueForKeyPath method.