Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 7 beta debugger not showing values of variable at breakpoint for Swift code

Tags:

I have tried the answers from question here but none of them helped :(

I have installed Xcode 7 beta 5 and the debugger will not show values of variables when debugging swift code. It works fine in Obj-C code.

I have tried changing the Compiler Optimisation level to None and it had not effect.

enter image description here

like image 764
Abdullah Umer Avatar asked Aug 13 '15 15:08

Abdullah Umer


2 Answers

I was still finding this an issue in the final release of XCode 7.0. It turns out my bridging header needed updating as one of the references was no longer needed in it.

I found that out by using 'po' in the debugger for one of the variables, e.g. 'po self.views'. The debugger then listed all the errors in the bridging header for me. Weird way to find out the problem but it worked.

EDIT: And just in case do a clean build after fixing any issues

like image 196
Allan Weir Avatar answered Sep 25 '22 17:09

Allan Weir


This may be due to a problem in the bridging file between Swift and Objective-C, e.g the file {projectName}-Bridging-Header.h . To make sure about that:

1- add a breakpoint at the place you want to debug.

2- After the breakpoint is reached, write the lldb command po on any object in the xCode debugging output window. for example :

po self.view 

If there is a problem you should see it's log and hopefully you can go and fix it

like image 43
Mostafa Abdellateef Avatar answered Sep 25 '22 17:09

Mostafa Abdellateef