xcode iOS 的 LLDB 的 P 命令不打印帧变量

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13828927/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:17:42  来源:igfitidea点击:

iOS's LLDB's P command not printing frame variable

iosxcodelldb

提问by mskw

Lets say I want to do a

假设我想做一个

p uiTextFieldObj.frame

it will say error: property

它会说错误:财产

'frame' not found on object of type 'UITextField *'

Is there any tricks I can do so I can get this to show?

有什么技巧可以让我展示这个吗?

回答by rob mayoff

You can do this:

你可以这样做:

p (CGRect)[uiTextFieldObj frame]

As of Xcode 4.5.2, printing properties in lldb using the dot syntax only seems to work for properties of objects defined in your app, not for properties defined by framework classes.

从 Xcode 4.5.2 开始,使用点语法在 lldb 中打印属性似乎只适用于应用程序中定义的对象的属性,而不适用于框架类定义的属性。

回答by GracelessROB

You can get it to print by doing [] notation instead of . notation:

您可以通过使用 [] 符号代替 . 符号:

Have you tried this?

你试过这个吗?

print (CGRect)[textfieldObj frame]

Without the (CGRect) cast, it will most likely show an error saying that it doesn't know the return type. You can also just do:

如果没有 (CGRect) 转换,它很可能会显示一个错误,指出它不知道返回类型。你也可以这样做:

po textfieldObj

which will show you the frame and some other information about the text field. the po debug command will call the objects -description method, which you can override to provide any information you like.

这将显示框架和有关文本字段的其他一些信息。po debug 命令将调用 objects -description 方法,您可以覆盖该方法以提供您喜欢的任何信息。

回答by onmyway133

See An @import-ant Change in Xcode

请参阅Xcode 中的 @import-ant 更改

LLDB's parser for Objective-C can now go through any module used in your app and determine the types used for all functions and methods it defines

LLDB 的 Objective-C 解析器现在可以遍历应用程序中使用的任何模块,并确定用于它定义的所有函数和方法的类型

e @import UIKit;
po uiTextFieldObj.frame