Command failed due to signal: Abort trap: 6

前端 未结 30 2600
暖寄归人
暖寄归人 2020-12-01 08:56

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

\"screenshot

30条回答
  •  天命终不由人
    2020-12-01 09:50

    Ok, in my case it was because I had an enum nested in a generic class. Now, the strange thing, is that when I isolated the problem (into the BaseDao2), the compiler told me the right error, but in my real BaseDao implementation (which has more stuff), it throw "trap 6".

    Type 'DaoError2' nested in generic type 'BaseDao2' is not allowed
    

    When I had this:

    class BaseDao2: InjectRestSession{
    
        enum DaoError2: ErrorType{
            case FAILED_RESPONSE(String)
            case INVALID_RESULT(String)
            case FAIL_TO_LIST, FAIL_TO_GET
        }
    
        func get() -> T?{
            return nil
        }
    }
    

    Anyway, in my case, I move the DaoError out of the BaseDao and everything compiled. Anyway, my feeling is that "trap 6" is what something cannot compile and the compiler got confused. Starting from a simple case, and adding back what you think might be causing the problem can be helpul to identify the problem by getting the right compile error. In other word, you have to be gentle with the swift compiler.

提交回复
热议问题