我想在调试时显示viewController。所以我想在LLDB的帮助下完成这项任务。我阅读了一些文章,这些文章给我以下建议。
(lldb) e id $vc = [UIViewController new]
(lldb) e (void)[[$vc view] setBackgroundColor:[UIColor yellowColor]]
(lldb) e (void)[$vc setTitle:@"Yay!"]
(lldb) e (void)[$nvc pushViewContoller:$vc animated:YES]
但是如果我想显示自定义viewController而不是默认UIViewController,则lldb将显示如下错误
Error [IRForTarget]: Couldn't resolve the class for an Objective-C static method call
error: The expression could not be prepared to run in the target
那我该怎么做呢?
答案 0 :(得分:1)
要解决此问题,您可以使用NSClassFromString()
:
(lldb) e id $vc = (id)[NSClassFromString(@"TheClass") new]