Xcode 7 command failed due to signal: illegal instruction 4

后端 未结 2 720
没有蜡笔的小新
没有蜡笔的小新 2021-01-12 10:24

I just used Xcode 7\'s migration tool to migrate a project from Swift 1.2 to 2. After fixing up errors missed and such, all is well except for an error which prevents me fro

相关标签:
2条回答
  • 2021-01-12 10:42

    'Illegal instruction' simply means that your binary contains instructions that are invalid for the type of architecture you are trying to run the code with. Start looking at the minimum version in your project build settings.

    0 讨论(0)
  • 2021-01-12 10:56

    So an answer was found thanks to the help of a coworker. We found the offending file in the build error, but there was no line provided. Through process of elimination, we found it to be a line that was declaring a new constant to the result of getting a JSON dictionary ([String : AnyObject], typealiased to JSONDictionary), from inside an optional dictionary. Here is the line:

    let objectsDictionary = maybeJSON?[key] as? JSONDictionary

    Changed this to two guard statements:

    guard let goodJSON = maybeJSON as? JSONDictionary else { return ... }
    guard let objectsDictionary = goodJSON[key] as? JSONDictionary else { return ... }
    

    This line worked in Xcode 6.3.2 as it would just provide an optional value, but for some reason, some change in Xcode 7 didn't like this. I hope this can help anyone else who runs across this.

    0 讨论(0)
提交回复
热议问题