gpt4 book ai didi

ios - 如何使用 swift 语言在 lldb 控制台中呈现/推送自定义 viewController

转载 作者:行者123 更新时间:2023-11-28 14:33:58 24 4
gpt4 key购买 nike

我想在调试时显示一个 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

那么我该怎么做才能实现它呢?

最佳答案

作为解决方法,您可以使用 NSClassFromString():

(lldb) e id $vc = (id)[NSClassFromString(@"TheClass") new]

关于ios - 如何使用 swift 语言在 lldb 控制台中呈现/推送自定义 viewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51040858/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com