Xcode debugger doesn't print objects and shows nil, when they aren't

Are you sure you are not in "Release mode"?

If you want to see variable values you have to be in "Debug mode" (click on your project name on the top left corner near start/stop buttons, then "Edit scheme...", then "Run" settings, then "Info" tab, then "Build Configuration". Here set "Debug". If it was on "Release" that's the matter you saw all nils).


I've set "Optimization Level" for Debug configuration to "None" and it solved problem.

  • Go to project Build settings
  • Search Debug
  • Under Apple Clang - Code Generation check Optimization Level
  • Set Debug to None [-OO]

After that, you will be able to see variable values in the debug area or console. enter image description here


Make sure that Address Sanitizer is turned off in your Scheme settings. The Address Sanitizer does not work well with the debugger.

  1. Go to Edit Scheme (Product >> Scheme >> Edit Scheme), choose Run, and go to the Diagnostics tab.
  2. Make sure "Enable Address Sanitizer" is off.

enter image description here