This happens to me pretty often. For example, right now I have the debugger stopped at a breakpoint in a method . . . and it isn\'t displaying any variable values at all.
One possible reason for the debugger displaying seemingly wrong values is that the variable type is of Any?
.
E.g.
var a: Any? = 12
var b: Int? = a as? Int // b=13483920750
var c: Int = a as? Int ?? 0 // c=1
In the example above, b
holds the correct value of 1
even though it is not displayed as such.
A possible solution is to set the Optimization Level for your current target Debug scheme to none.
Project -> Target -> Build settings -> Optimization level -> Debug (or whatever fits your project) -> None
Source:
https://stackoverflow.com/a/14948486/3590753
If your breakpoint has "automatically continue after evaluating options" set, then it won't write to the variable view - FYI
temporary solution when it happpen to me : right click on the property jump to definition (u can do it manually and scroll to the @synthesize in the top of the file)
now, if the line is like this :
@synthesize myObject = _myObject ;
set the mouse cursor on the "_myObjects". that what worked for me..when i have problems.
My issue was that I had address sanitizer enabled. Disabling sanitizer resolved my issue in XCode 8.2.1
If you are using the @property feature of Objective-C 2.0 the debugger does not display those variables unless they are backed by explicit ivars in your Class interface. This is slated to be fixed in Xcode 4 as I understand it.