Reputation: 2651
I want to watch variable [UIScreen mainScreen].brightness
.
So I click rmb in watch window, select Add expression and enter [UIScreen mainScreen].brightness
as my expression to watch. Xcode evaluates it but does not show the value.
How to watch it properly?
Upvotes: 2
Views: 101
Reputation: 131418
I don't think you can watch a property. You have to watch an instance variable. (Watchpoints actually use hardware support to monitor a memory address for changes. Properties are actually specialized syntax for a method call, and there's no memory address for the result of a method call.)
Since you're trying to watch a property in a system class you might be out of luck. Instead, you might need to write code that adds a KVO observer for the main screen's brightness value, and set a breakpoint in the observer code.
Upvotes: 3