6

I'm having a very weird problem - as you can see in the picture below, the debug shows that the program entered to the if statement, but the value of color is shown as nil !!!

obviously that's can't be true, and I suspect that the Xcode is showing incorrect values on the inspector \ variable view (at the debug area).

I have no idea - maybe my Xcode had too much vodka?

any HELP please???

updates:

  • I tried to restart my mac - didn't help.
  • my Xcode version: 6.4

going in an if statement will nil argument

Aviram Netanel
  • 12,633
  • 9
  • 45
  • 69
  • What happens if you type `po color` in the debugger? – rmaddy Oct 22 '15 at 14:14
  • 1
    @rmaddy - po color gives me: error: warning: couldn't get cmd pointer (substituting NULL): extracting data from value failed Couldn't materialize: couldn't get the value of variable color: variable not available Errored out in Execute, couldn't PrepareToExecuteJITExpression – Aviram Netanel Oct 22 '15 at 14:38
  • you can set the level of debug information in either your build configuration or maybe by target. Don't exactly remember how. Google it should not be to hard to find (if that is the problem). – Peter Segerblom Oct 22 '15 at 15:26
  • 1
    @AviramNetanel Did you restart your xcode? Something it happens on my system and I just restart xcode or re-run the applicaiton. BTW what is your xcode version? – Inder Kumar Rathore Oct 26 '15 at 09:50
  • 1
    Did you check this question : http://stackoverflow.com/q/19870176/468724 – Inder Kumar Rathore Oct 26 '15 at 09:53
  • Hi. I'm interesting wtf is XRC.sh? database? or what? Probably you need start a session before extract any value? One more decision: you can create category of UIColor with necessary colors (set of methods which return colors) and use it instead of your approach. – user3820674 Oct 26 '15 at 10:08
  • XRC.sh gives you a dictionary with colors, basically color is assigned with UIColor. – Aviram Netanel Oct 26 '15 at 11:16
  • The problem has nothing to do with "Build Configurations", but with what the specific build configuration is running. You can copy / rename / change the build configurations at your will. However, just changing to the default configuration "Debug" doesn't solve the problem in xcode 8, and neither does changing the optimization levels, the other flags etc. Still waiting for a solution that works on all cases. – kindaian Dec 19 '16 at 13:22

2 Answers2

22

I've seen the "extracting data from value failed" message (when doing a po foo at the LLDB prompt), even on debug builds . This appears to be an LLDB bug.

A workaround that worked for me was to cast the value to the expected return type (e.g. if it's an NSNumber, po (NSNumber *)foo).

Frank Schmitt
  • 25,648
  • 10
  • 58
  • 70
5

Check your scheme - Run tab on the left should have the Debug executable option checked.

If you are running on AdHoc \ Release mode, the debugger will not show the right values.

Change the "Build Configuration" to "Debug".

bdalziel
  • 2,005
  • 3
  • 17
  • 32
nivbp
  • 310
  • 1
  • 11