use*_*687 14 xcode ios swift xcode6 ios8
我在我的代码中收到此编译器错误,我无法弄清楚原因:
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)
Command /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 254
Run Code Online (Sandbox Code Playgroud)
错误显示在以下代码段中的某处:
var animalViewToSwap: AnimalView = animalViewMatrix.objectAtRow(0, andColumn: 0) as AnimalView
var currentRow = 0
var currentColumn = 0
var animalToSwapWith = true
var currentLocation = animalViewMatrix.findLocationOfObject(animalView)
currentRow = Int(currentLocation.row) - 1
currentColumn = Int(currentLocation.column) - 1
var rowDisplacement = 0
var columnDisplacement = 0
switch inDirection{
case "left":
columnDisplacement = withDistance * -1
if (Int(animalViewMatrix.columns) > currentColumn + columnDisplacement)&&(currentColumn + columnDisplacement >= 0)&&(animalViewMatrix.objectAtRow(CInt(currentRow), andColumn: CInt(currentColumn + columnDisplacement)) is AnimalView)
{
animalToSwapWith = true;
}
else { animalToSwapWith = false }
default:
println("error")
animalToSwapWith = false
break
}
Run Code Online (Sandbox Code Playgroud)
(我有更多的情况非常相似,并且为了简单起见而将它们排除在外 - 错误不在其中)
行中有一个错误:animalToSwapWith = false如果我将其设置为true并在变量初始化行之外注释所有其余部分,则错误消失.此外,如果我将所有内容都注释掉但将animalToSwapWith实例化为false,则会发生错误,即使它实例化为true时也不会发生错误.
该行中存在第二个错误:if (Int(animalViewMatrix.columns) > currentColumn + columnDisplacement)&&(currentColumn + columnDisplacement >= 0)&&(animalViewMatrix.objectAtRow(CInt(currentRow), andColumn: CInt(currentColumn + columnDisplacement)) is AnimalView)在此行中,所有这些方法都已在文件中使用上述相同类型的变量进行调用,因此对方法的了解无关紧要.
是否有原因导致这两个错误发生,或者是因为swift和Xcode-6仍然处于beta测试状态并且它是Xcode中的一个错误?另请注意,当一次一个地将两个错误注释掉时,错误消息是相同的.
Pas*_*cal 17
这是一个Swift编译器错误,显然测试两个或多个隐式解包的选项会导致编译器在某些/许多情况下崩溃.使用Apple的Bugreporter提交此问题,将其标记为rdar:// 17212295的副本.
这是一个与同一错误崩溃的最小示例:
let a: String!
let b: String!
if a && b {
println("have both")
}
Run Code Online (Sandbox Code Playgroud)
在命令行上编译如下,见证同样的崩溃:
$ xcrun swift -v -g crash.swift
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6350 次 |
| 最近记录: |