What changed in xcode7 debugger that I can no longer view variables with “po” / Swift

假装没事ソ 提交于 2020-01-30 05:28:56

问题


ok what changed in xCode7 / Swift that I can no longer use "po frame" to view the contents of a CGRect anylonger? The print statment works just fine in the code. How come I can't view that in the debugger console like I used to?

var frame = self.myLabel.frame

frame.origin.x = self.startingFrame.origin.x + translation.x
frame.origin.y = self.startingFrame.origin.y + translation.y

print(frame)

self.myLabel.frame = frame

yet in the debugger if I break on the self.myLabel.frame = frame statement and use po (or p or print) in the debugger I get:

(164.0, 323.0, 41.6666666666667, 20.3333333333333)
(lldb) po frame
error: <EXPR>:1:1: error: use of unresolved identifier 'frame'
frame
^~~~~
(lldb) p frame
error: <EXPR>:1:1: error: use of unresolved identifier 'frame'
frame
^~~~~
(lldb) print frame
error: <EXPR>:1:1: error: use of unresolved identifier 'frame'
frame
^~~~~
(lldb) 

回答1:


This is a bug in Xcode 7.1. It is fixed in the current 7.2 beta, and will be fixed in the final. The bug is that the types for Structs imported from C/ObjC modules into Swift are not available to the debugger (and in turn it won't report variables whose types are unavailable.)




回答2:


I am still seeing this in Xcode 7.2 (using ObjC). Makes it very frustrating debugging layout code.

The debugger doesn't show the frame as an ivar of the views and type summaries won't print it. You have to 'po foo.frame' to see it.



来源:https://stackoverflow.com/questions/33215765/what-changed-in-xcode7-debugger-that-i-can-no-longer-view-variables-with-po

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!