19

I have an issue with the Xcode debugger. Everything works fine in general, I can print variables using po <var> normally... Except in some files, where I can't print anything, and I have a error: Couldn't apply expression side effects : couldn't get the data for variable self error in the console.

Xcode debugger

Weirdly, Xcode shows values correctly on the left debugger panel.

Does anyone have an idea?

Thanks!

tdimeco
  • 856
  • 7
  • 12
  • 1
    https://stackoverflow.com/questions/19870176/xcode-debugger-doesnt-print-objects-and-shows-nil-when-they-arent – Lu_ Apr 19 '18 at 09:38
  • 1
    Xcode debugger is so buggy, use `debugPrint` in code instead, for printing. – badhanganesh Apr 19 '18 at 09:56
  • @Lu_ I am actually in Debug configuration, Optimizations are set to Onone, I cleaned DerivedData... Everything seems to be OK :s – tdimeco Apr 20 '18 at 08:33

1 Answers1

22

Similar observations, all good on the left panel but printing ends with the same message. Quick improvement was to use:

po print(variable)

or

po debugPrint(variable)

Result - prints variable and appends the same error message.

Julian
  • 9,299
  • 5
  • 48
  • 65