无法使用Xcode 7.3.1在我的Swift 2项目中使用“ po”检查变量-错误加载帮助程序功能

佛朗哥·索莱里奥

当我在Xcode 7.3.1(使用标准Swift 2编译器)中运行我的Swift应用程序并且执行在断点处暂停时,我无法使用po命令检查变量第一次运行po existsexists在当前作用域中是非可选的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

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

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) 
佛朗哥·索莱里奥

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

protocol MyCustomStringConvertible {}

extension MyCustomStringConvertible where Self: RawRepresentable, Self.RawValue == String {
   ..
}

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

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

xcode7调试器中的更改使我无法再使用“ po” / Swift查看变量

在Flutter项目中使用Xcode中的Swift Package Manager添加依赖项时生成错误

如何在swift3项目中使用目标c视图控制器

我可以在Java 7中编译的项目中使用Java 7中编译的jar作为依赖项吗?

使用细枝在Slim 3项目中雄辩的分页功能

在新的VS Studio 2017 ASP.NET MVC 5.2.3项目中使用C#7功能时编译错误

在我的angular 2项目中使用外部JS库

在同一项目中使用Yii1和Yii2

如何在使用vue-cli3创建的Vue2项目中使用axios

PromiseKit无法使用Swift 2和Xcode 7进行编译

在我的项目中使用Django-tables2时出现上下文错误

我正在寻找一种在Angular 7项目中使用Kendo进行多列下拉列表框的方法

如何在一个 angular 7 项目中使用 2 个不同的引导程序主题?

在Xcode 5项目中使用Core Plot 2

如何使用基石在angular 7项目中加载dicom文件

我可以在netstandard2.0项目中使用netstandard1。*库吗?

我无法在.net 4.7项目中使用System.Runtime 4.3.0

Xcode6 beta 7 Swift无法使用UIPickerViewDataSource

在我自己的项目中使用jrawio会导致错误

尝试在我的项目中使用UIKit但出现错误

我在同一项目中使用了Google Analytics API v3和v4。会造成任何问题吗?

无法在我的项目中使用字体:-“错误:错误:文件名必须以.xml结尾”

如何在Swift 3中使用Pods使用Swift 4.0构建xcode 9项目?

在Vue CLI 3项目中使用自定义Bootstrap SASS的步骤是什么?

使用swift 2(xcode 7 beta 5)解析注册错误

在我的 spring-boot 项目中使用 lombok 依赖项,但 getter 方法在运行时产生错误(尽管构建成功)

在Ionic 2项目中使用哪个View lifeCycle

在Qt 5项目中使用Nite 2

我可以在非cn1项目中使用parse4cn1吗?