升级到 Swift 2.0 时出现分段错误 11
我有一个 iOS 项目,截至昨天,它运行良好.现在我已经更新到 Xcode 7,带来了 Swift 2.0 语法.我按照使用新语法的建议解决了所有错误.当我尝试构建时,构建失败并显示由于信号导致命令失败:分段错误:11".这发生在 4 个不同的文件上.
I have an iOS project that as of yesterday was working perfectly. Now I've updated to Xcode 7, bringing Swift 2.0 syntax. I went through and resolved all the errors as suggested to use new syntax. When I try to build, the build fails with a "Command failed due to signal: Segmentation fault: 11". This occurs on 4 different files.
问题是,这四个文件没有任何需要更新的代码,而且是非常简单的文件(其中除了将标签设置为属性值之外什么都不做).什么给?
The problem is, those four files didn't have any code that needed updating, and are quite simple files (on of them doesn't do anything but set a label to a property value). What gives?
我想通了.问题是编译器没有捕捉到几个错误.我让 Xcode 通过删除文件来查找错误,然后重新添加它.这表明还有 30 多个错误,这些错误在修复后会导致我的代码完全编译.
I figured it out. The problem was that there were several errors that the compiler was not catching. I got Xcode to find the errors by deleting a file, and then re-adding it. This showed thirty-something more errors that, when fixed, caused my code to compile completely.