使用Xcode 7.3.1无法在我的Swift 2项目中使用"po"检查变量 - 错误加载帮助函数

Fra*_*rio 8 debugging xcode ios swift

当我在Xcode 7.3.1(使用标准Swift 2编译器)中运行我的Swift应用程序并在断点处执行暂停时,我无法使用po命令检查变量.我第一次运行po exists(exists在当前范围内是一个非可选的Bool变量)我得到一个很长的错误消息(见下文).从第二次开始运行相同的命令,我收到error loading helper function: (null)消息.

应用程序在调试方案上编译和运行,没有"部署后处理"和无[-O0]优化.

变量内容在Xcode的变量检查器面板中正确显示.

po self在设备和iOS模拟器上运行相同的错误或任何其他变量.

如果我运行一个新的干净项目,调试po正常工作.


在目前的范围内:

var exists: Bool = self.canRemoveAttachmentForEpisode(episode)
NSLog("Exists is now \(exists)") // Breakpoint is set here
Run Code Online (Sandbox Code Playgroud)

这是调试器面板中发生的情况:

po exists
error loading helper function: <EXPR>:141:9: warning: '--' is deprecated: it will be removed in Swift 3
        --maxItemCounter
        ^~
                         -= 1
<EXPR>:237:14: warning: '++' is deprecated: it will be removed in Swift 3
            i++
             ^~
              += 1
<EXPR>:267:19: warning: 'init(start:end:)' is deprecated: it will be removed in Swift 3.  Use the '..<' operator.
        let rng = Range(start: si, end: ei.advancedBy(-1))
                  ^
<EXPR>:280:9: warning: initialization of variable '$__lldb_error_result' was never used; consider replacing with assignment to '_' or removing it
    var $__lldb_error_result = __lldb_tmp_error
    ~~~~^~~~~~~~~~~~~~~~~~~~
    _
<EXPR>:89:41: error: 'CustomStringConvertible' is ambiguous for type lookup in this context
                    if let csc = (x as? CustomStringConvertible) {
                                        ^~~~~~~~~~~~~~~~~~~~~~~
Swift.CustomStringConvertible:13:17: note: found this candidate
public protocol CustomStringConvertible {
                ^
Castamatic.CustomStringConvertible:1:17: note: found this candidate
public protocol CustomStringConvertible {
                ^
<EXPR>:101:41: error: 'CustomStringConvertible' is ambiguous for type lookup in this context
                    if let csc = (x as? CustomStringConvertible) {
                                        ^~~~~~~~~~~~~~~~~~~~~~~
Swift.CustomStringConvertible:13:17: note: found this candidate
public protocol CustomStringConvertible {
                ^
Castamatic.CustomStringConvertible:1:17: note: found this candidate
public protocol CustomStringConvertible {
                ^


(lldb) 



(lldb) po exists
error loading helper function: (null)

(lldb) 
Run Code Online (Sandbox Code Playgroud)

Fra*_*rio 2

我解决了这个问题。问题是我正在重新定义现有协议:

protocol MyCustomStringConvertible {}

extension MyCustomStringConvertible where Self: RawRepresentable, Self.RawValue == String {
   ..
}
Run Code Online (Sandbox Code Playgroud)

我重新定义了 CustomStringConvertible 协议,或者当我编写自己的版本时,Apple 的 CustomStringConvertible 可能不存在。可能该协议仅在调试时使用po,因此在运行时从未出现错误。

我唯一的疑问是:编译器不应该提醒我重新定义现有协议吗?