有没有办法在Swift中使用[self.view recursiveDescription]呢?我正在try 使用此方法,但出现以下错误:
'UIView' does not have a member named 'recursiveDescription'
有什么建议吗?
有没有办法在Swift中使用[self.view recursiveDescription]呢?我正在try 使用此方法,但出现以下错误:
'UIView' does not have a member named 'recursiveDescription'
有什么建议吗?
要从Swift访问私有/未记录的Objective-C API(如UIView
上的-recursiveDescription
方法),您可以执行以下操作:
UIView
).在类别标题中声明私有方法:
// UIView+Debugging.h
@interface UIView (Debugging)
- (id)recursiveDescription;
@end
现在,您可以设置断点并在LLDB中打印递归描述:
po view.recursiveDescription() as NSString