Problems encountered

Not long ago, several friends in the group had this problem, which was caused by the upgrade of the old project to Xcode12.

At first glance, this problem seems to be caused by no permissions, but I guess Xcode is not stupid enough to generate its own executable file without permissions. Let’s click on detail and see:

Find the path to display and display package contents, result no execution file. Xcode didn’t generate an executable, and my first thought was that there was something wrong with the ARCH setup

aboutEXCLUDED_ARCHSandVALID_ARCHS

EXCLUDED_ARCHS are new fields in Xcode12 that represent archs you don’t want to compile, the rest of apple’s archs will be compiled automatically. VALID_ARCHS are pre-Xcode 12 fields that represent archs that are allowed to compile. Personally, the EXCLUDED_ARCHS will have the advantage, as soon as Apple launches the new CPU Arch, you won’t have to add it yourself, it will automatically add and compile it for you.

New projects on Xcode12 will no longer have the VALID_ARCHS field, old projects that have not had the VALID_ARCHS set will automatically disappear when they run on Xcode12. However, if you set the VALID_ARCHS, the field will be retained and moved to the User-defined module, drag it to the bottom of the Build Settings to find it.

The analysis reason

Two causes were found for the problems in the cluster:

  • The first: The old project VALID_ARCHS used to have arm64, etc., but with the update to Xcode12, the logic is different and you’ll have to add x86_64 yourself, otherwise the x86_64 won’t be added to the compile, so running the emulator will report the error. Because the executable file for x86_64 is not generated.

  • Second: Xcode12 has a emulator version of arm64 architecture because of the m1-chip Mac. However, many projects have static packages (.a files) that don’t support this architecture, so emulators fail to run properly, the EXCLUDED_ARCHS simply added the arm64, so that the emulators will run properly, but the real ones will report errors. Because the arm64 executable file is not generated.

How to solve

  1. If your project contains the VALID_ARCHS, delete this field completely. Find your project’s.xcodeproj file, right-click to display the package contents, open project. Pbxproj, search for the VALID_ARCHS, and delete all the rows searched for the VALID_ARCHS.

  2. Set the EXCLUDED_ARCHS field correctly, if your PC is not ARM64 architecture (currently M1 chips), do as follows:

Other possible causes and solutions for this error

The value of the Executable file in the info.plist file was different from the name of the Executable file. As a result, the Executable file could not be found during execution and the error in the problem would be reported. The solution is to change the Executable file name of the info.plist project to the same name as the Executable file.