【问题标题】:XCode : Cannot print object in console when debugingXCode:调试时无法在控制台中打印对象
【发布时间】:2023-01-14 03:14:51
【问题描述】:

无缘无故,当我想使用调试器控制台打印时,Xcode 显示错误:

(lldb) po self
warning: Swift error in scratch context: error: failed to load module 'XXX'
.
Shared Swift state for XXX.app has developed fatal errors and is being discarded.
REPL definitions and persistent names/types will be lost.

error: expression failed to parse:
unknown error

这是一个带有 cocoapods 的 iOS 项目。我在使用 M1 pro 芯片。

任何的想法 ?

【问题讨论】:

    标签: ios xcode


    【解决方案1】:
    1. 我将从简单的print(self) 指令开始,然后检查控制台中显示的内容。
    2. 我也喜欢debug(self) 功能。
    3. 如果要打印线程,可以使用Thread.callStackSymbols.forEach { print($0) }
    4. 您是否尝试过设置断点并浏览变量列表(调试区域的左侧)?

    【讨论】:

      猜你喜欢
      • 2021-02-17
      • 2018-03-26
      • 2015-10-02
      • 2011-11-02
      • 2013-01-21
      • 1970-01-01
      • 2023-03-23
      • 2023-02-04
      • 1970-01-01
      相关资源
      最近更新 更多