A property/ivar/outlet was just changed, how do I find out who did it?

I see this post all the time on StackOverflow. The answer is surprisingly simple:

– if you have an ivar, convert it to a property with a synthesize ivar=ivar if needbe to avoid having to prepend a “_” to usages

– write your own setter, and add logic tests and NSLog messages

Рput a breakpoint on the NSLog message, and run your app

Voila! You app stops when the value changes, and you can see who the offender is!

Advertisements