Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode debug inspector shows values as nil

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

like image 355
Aviram Netanel Avatar asked Oct 22 '15 14:10

Aviram Netanel


People also ask

How do I see variables in Xcode?

There is 2 ways to watch a variable and break at certain condition. Control-click a breakpoint indicator to display a command menu and choose Edit Breakpoint to open the breakpoint editor and set conditions, add actions, and so forth, as mentioned in Breakpoints. Use LLDB command line.

How do I enable debug mode in Xcode?

When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.

How do I print a variable in Xcode?

Print a variableClick the Add Action button and select Debugger Command. Put any print command in a debug console in a text field. Make sure you prefix it with po , e.g., po print(view) . Check Automatically continue after evaluating actions.


2 Answers

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).

like image 160
Frank Schmitt Avatar answered Nov 03 '22 08:11

Frank Schmitt


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".

like image 40
nivbp Avatar answered Nov 03 '22 10:11

nivbp