调试时,这类事情让我抓狂:

(lldb) p self.bounds
error: unsupported expression with unknown type
error: unsupported expression with unknown type
error: 2 errors parsing expression
(lldb) p (CGRect)self.bounds
error: unsupported expression with unknown type
error: unsupported expression with unknown type
error: C-style cast from '<unknown type>' to 'CGRect' is not allowed
error: 3 errors parsing expression
(lldb) p [self bounds]
error: 'bounds' has unknown return type; cast the call to its declared return type
error: 1 errors parsing expression
(lldb) p (CGRect)[self bounds]
(CGRect) $1 = origin=(x=0, y=0) size=(width=320, height=238)
(lldb) You suck!
error: 'You' is not a valid command.
(lldb) …

为什么前三次try 都失败了?有没有更简单的打印self.bounds的方法?谢谢

推荐答案

从Xcode 6.3开始,我们有了更好的解决方案.简而言之,您需要导入UIKit以便LLDB了解以下类型:

Objective-c相关问答推荐

反编译ARM64和理解分支目标边界

如何检测 iPhone 5c 的 colored颜色 ?

Xcode 是否支持区域?

iPhone:推送通知后如何删除徽章?

iOS 心率检测算法

如何在 iPhone 应用程序的 UINavigationBar 中添加图像

是否可以将 NSInteger 转换为 NSNumber?

使用 [NSBundle mainBundle] pathForResource: ofType:inDirectory: 访问文件

如何将 UInt32 设置为最大值

Objective-C (cocoa) 等价于python的endswith/beginswith

[Facebook-iOS-SDK 4.0]如何从FBSDKProfile获取用户邮箱

将子视图添加到 UIButton

使用情节提要的条件转场

UILabel 的角半径属性在 iOS 7.1 中不起作用

动画 UIButton 状态变化

Modal segue,导航栏消失

允许用户从 UILabel 中 Select 文本进行复制

以编程方式设置 UIView 的自动调整大小掩码?

UIImageView 并不总是为模板图像着色

更改导航栏的字体