swift - LLDB 输出错误 : use of undeclared type '$__lldb_context'

标签 swift xcode console lldb

为什么有时当我尝试像这样在控制台中打印时:

 po trip.id

我得到:

error: <EXPR>:1:11: error: use of undeclared type '$__lldb_context'
extension $__lldb_context {                            
          ^~~~~~~~~~~~~~~
<EXPR>:16:5: error: use of unresolved identifier '$__lldb_injected_self'
    $__lldb_injected_self.$__lldb_wrapped_expr_79(     
    ^~~~~~~~~~~~~~~~~~~~~

error: <EXPR>:1:11: error: cannot find type '$__lldb_context' in scope
extension $__lldb_context {
          ^~~~~~~~~~~~~~~

有什么办法可以解决吗?

最佳答案

为了让表达式像被注入(inject)到当前选定的帧中一样运行,我们需要构造一个具有适当的 self 参数的上下文(例如,某种类扩展),并评估表达式中的代码那个上下文。显然,您尝试打印“trip.id”的上下文是调试器无法重建的上下文。如果您可以使用 http://bugreporter.apple.com 提交错误报告这一点,我们可以弄清楚如何支持这一点。

如果您没有使用 Xcode 8.0,您可以尝试一下,修复了一堆此类错误。

lldb 有另一个命令,“frame variable”,它提供对局部变量的快速访问。它不能运行函数调用等,但由于它不那么雄心勃勃,所以有时更健壮。你可能会尝试这样的事情:

(lldb) frame variable -O trip.id

关于swift - LLDB 输出错误 : use of undeclared type '$__lldb_context' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39769254/

相关文章:

iphone - Storyboard 和 Container View 的疯狂行为

firefox - Firefox 浏览器控制台没有提示?

java - Log4j 如何阻止记录器打印到控制台?

ios - 从 didSet 调用方法时委托(delegate)返回 nil

ios - 如何将 Cordova 项目中使用的插件添加到 iOS 原生项目中

ios - UITextView的限制行数

python - 从 linux 控制台运行一个函数(从 .py 文件)

ios - 将闭包保存为变量理解

ios - iOS 系统默认的希伯来语字体是什么?

ios - 来自可重复使用的表格单元格的不同 segues