Xcode 7 compile error : “Command failed due to signal: Segmentation fault: 11”

前端 未结 25 2361
耶瑟儿~
耶瑟儿~ 2020-12-01 05:37

Yesterday I installed the official Xcode 7 and when I tried to open one of my Swift projects, appeared an alert saying that the new Xcode version wants to update my swift co

25条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 06:18

    For me, the problem (XCode 7.3.1) was using a += operator on a dictionary item.

    for example:

    func test() {
        var myDict:[String:String] = [:]
        myDict["key"] = "pig"
        myDict["key"] += "dog"
    
        var myArray:[String] = []
        myArray.append("pig")
        myArray[0] += "dog"
     }
    

    This will cause a segmentation fault. Remove the += on myDict, and all is ok.

    I am aware this is a bug (dictionary references are nullable) but the compiler should not crap out like this.

提交回复
热议问题