Command failed due to signal: Abort trap: 6

2020-01-28 04:56发布

Since Xcode 7 and Swift 2.0, I get the error above, like in the screenshot shown here:

screenshot of error log

I have no idea where this is coming from, cleaning and deleting derived data didn't work.

Anyone else experiencing this problem?

Project settings:

project settings

Target settings:

target settings

标签: swift xcode
30条回答
放我归山
2楼-- · 2020-01-28 05:46

I got this message when using do-try-catch in a Failable initializer:

public init?() {
    do {
        ...
        super.init(superParam: try getParamForSuper())
        ...
    } catch {
        ...
    }
}

The compilation succeeded when moving the try call to it's own local variable:

public init?() {
    do {
        ...
        let superParam = try getParamForSuper()
        super.init(superParam: superParam)
        ...
    } catch {
        ...
    }
}
查看更多
够拽才男人
3楼-- · 2020-01-28 05:48

I was having this same problem and I found the problem was that I had changed the build system to "New Build System" after reading an article on "how to speed up your builds" (This is the article btw here)

So to go back to the standard build system:

  1. To enable the new build system, go to File → Project Settings (or Workspace Settings).
  2. Change Build System to Standard Build System.

enter image description here

Hope it helps someone and don't waste hours trying to find out why this was not working!

查看更多
疯言疯语
4楼-- · 2020-01-28 05:48

My case, Swift 5.1, Xcode 10.3 (10G8)

Code was crashing Swift when a nested function was using the argument of an outer function as a default parameter.

e.g.

func foo(duration: TimeInterval) {
    func bar(duration: TimeInterval = duration) {
    }
}

I hope this helps.

查看更多
【Aperson】
5楼-- · 2020-01-28 05:49

In my case I had a private struct Constants declared in both class A and extension A.

Probably it should be giving an error but it didn't.

查看更多
【Aperson】
6楼-- · 2020-01-28 05:49

For me below statement cause an error.

let dict = mainDict as [String:String]

Fix the issue by force unwraps

let dict = mainDict as! [String:String]

There is nothing related to the compiler. It is just type casting issue, Apple should give proper description instead of the giving compiler error

查看更多
家丑人穷心不美
7楼-- · 2020-01-28 05:51

This worked for me, so just give it a try. i got this error while converting the code from swift 3 to swift 4.

Simply, go to Project>Target>Build Setting and search 'Swift Compiler - Code Generation' and set Optimization level to 'No Optimazation[-Onone]'.

查看更多
登录 后发表回答