I am running Xcode 12.5.1 on Big Sur 11.6 I have been building apps with Xcode for more than four years. Lately I have one app that all too frequently throws the following error:
Illegal Instruction: 4
I am using Swift with UIKit and a combination of Storyboards, Xibs and programmatic code.
I have searched extensively for a solution and have seen this stackoverflow post more than once in my quest. The most popular response is dated and this problem only happens on one specific app. I have reinstalled Xcode, I have rebooted, re-cloned the repository and cleaned the build folder until it is spotless. Co-workers do not experience the issue with the same repository.
How can I troubleshoot the root cause of this annoying error?
3
Answers
I found the answer in the most unlikely of places. A co-worker pointed me to this post.
It may be the currently opened project file, the new version of Xcode has been run, and you are using the old version of Xcode to open。
like:
current project file is running well on Xcode 13.4.1, but if your using Xcode 13.0 to open, then will be show "Illegal Instruction: 4".
please make sure using the same Xcode or New version
Try setting the compilation mode to Whole Module Compilation.