0

在我的课堂上,我有一个财产

@property (nonatomic, retain) UIBarButtonItem *allMediaButton;

在我的代码中,我使用setEnabled:setter 启用和禁用此控件。

但是在调试窗口中我无法检查属性值

我以不同的方式尝试过:

(lldb) po (UIBarItem*)appdelegate.detailViewController.allMediaButton
(UIBarItem *) $1 = 0x08302ed0 <UIBarButtonItem: 0x8302ed0>

(lldb) po (UIBarItem*)appdelegate.detailViewController.allMediaButton.enabled
error: property 'enabled' not found on object of type 'UIBarButtonItem *'
error: 1 errors parsing expression

(lldb) expr (UIBarItem*)appdelegate.detailViewController.allMediaButton.enabled
error: property 'enabled' not found on object of type 'UIBarButtonItem *'
error: 1 errors parsing expression

(lldb) expr ((UIBarItem*)appdelegate.detailViewController.allMediaButton).enabled
error: property 'enabled' not found on object of type 'UIBarItem *'
error: 1 errors parsing expression

(lldb) expr ((UIBarItem*)appdelegate.detailViewController.allMediaButton).enabled
error: property 'enabled' not found on object of type 'UIBarItem *'
error: 1 errors parsing expression

(lldb) po ((UIBarItem*)appdelegate.detailViewController.allMediaButton).enabled
error: property 'enabled' not found on object of type 'UIBarItem *'
error: 1 errors parsing expression

(lldb) po ((UIBarItem*)appdelegate.detailViewController.allMediaButton).isEnabled
error: property 'isEnabled' not found on object of type 'UIBarItem *'
error: 1 errors parsing expression

(lldb) expr ((UIBarItem*)appdelegate.detailViewController.allMediaButton).isEnabled
error: property 'isEnabled' not found on object of type 'UIBarItem *'
error: 1 errors parsing expression

(lldb) expr appdelegate.detailViewController.allMediaButton.isEnabled
error: property 'isEnabled' not found on object of type 'UIBarButtonItem *'
error: 1 errors parsing expression

(lldb) po  appdelegate.detailViewController.allMediaButton.isEnabled
error: property 'isEnabled' not found on object of type 'UIBarButtonItem *'
error: 1 errors parsing expression

(lldb) po  appdelegate.detailViewController.allMediaButton.enabled
error: property 'enabled' not found on object of type 'UIBarButtonItem *'
error: 1 errors parsing expression

(lldb) expr  appdelegate.detailViewController.allMediaButton.enabled
error: property 'enabled' not found on object of type 'UIBarButtonItem *'
error: 1 errors parsing expression

如何查看房产的价值?

更新: po @() 也不起作用:

(lldb) po  @([[[appdelegate detailViewController] allMediaButton] isEnabled])
error: no known method '-isEnabled'; cast the message send to the method's return type
error: 1 errors parsing expression

(lldb) po  @([(UIBarItem)[[appdelegate detailViewController] allMediaButton] isEnabled])
error: C-style cast from 'UIBarButtonItem *' to 'UIBarItem' is not allowed
error: 1 errors parsing expression

(lldb) po  @([(UIBarItem*)[[appdelegate detailViewController] allMediaButton] isEnabled])
error: no known method '-isEnabled'; cast the message send to the method's return type
error: 1 errors parsing expression

(lldb) po  @([((UIBarItem*)[[appdelegate detailViewController] allMediaButton]) isEnabled])
error: no known method '-isEnabled'; cast the message send to the method's return type
error: 1 errors parsing expression
4

2 回答 2

1

您不能(po)像这样打印 OBJECT,因为实际上enabled属性不是对象类型,而是 SCALAR。你可以试试po @( your scalar value here )

还有一件非常重要的事情是尝试执行以下操作以在不强制转换的情况下访问属性

po @([[[appdelegate detailViewController] allMediaButton] isEnabled])

那应该适合你

于 2013-09-18T14:29:18.220 回答
0

代替

po @(scalar)

采用

p scalar
于 2014-11-06T13:17:37.120 回答