I'm currently working on developing Android and iOS apps using Ionic, and I've come across an error: "command validateembeddedbinary failed with a nonzero exit code". My project comprises four components: app, customer, cart, and it appears that this error is specifically related to the customer component.

Solution to "Command ValidateEmbeddedBinary Failed with a Nonzero Exit Code" Error in Xcode

The "Command ValidateEmbeddedBinary Failed with a Nonzero Exit Code" error typically occurs in Xcode when there's an issue with validating or embedding binaries during the build process. This error can be caused by various factors, including incorrect configurations, missing files, or issues with code signing.

Possible Causes:

  • Missing or incorrect code signing settings.
  • Problems with the target's embedded binaries.
  • Issues with third-party frameworks or libraries.
  • Corrupted project settings or cache.

Solution:

To fix the "Command ValidateEmbeddedBinary Failed with a Nonzero Exit Code" error in Xcode, you can try the following steps:

1. Check Code Signing Settings:

Ensure that your code signing settings are correct for the target and that all necessary certificates and provisioning profiles are properly configured in Xcode.

2. Verify Embedded Binaries:

Check the embedded binaries section in your Xcode project settings to ensure that all required frameworks and libraries are correctly linked and located.

3. Clean Build:

Perform a clean build by deleting the derived data folder and cleaning the build folder in Xcode. This can help resolve any cached build issues.

4. Update Third-Party Dependencies:

If you're using third-party frameworks or libraries, make sure they are up-to-date and compatible with your Xcode version. Sometimes, updating these dependencies can resolve compatibility issues.

5. Check System Integrity Protection (SIP):

Ensure that System Integrity Protection (SIP) is enabled on your macOS system. SIP protects system files and folders, and disabling it can cause unexpected issues during the build process.

.

2

I encountered the same issue in a project created by someone else. I was unable to install an app on my iPhone, with React Native version 0.66 and Xcode version 12.

In Xcode, I made a change by adjusting the minimum deployment target from 10.0 to 11.0. 

However, even after making this adjustment, the error recurred after a few days. Upon further investigation, I discovered that the issue was caused by the following code in my Info.plist:

<key>CFBundleSupportedPlatforms</key>
  <string>MacOSX</string>

Removing this code resolved the error for me.


3

For us, simply cleaning the project worked using Shift+Command+K & Option+Shift+Command+K. This solution also worked when we were using Xcode 10.

Trying simple troubleshooting steps like cleaning the project before delving into more complex solutions. Often, issues can be resolved with straightforward actions like this, saving time and effort in the development process.

4

If we check the messages above the "Command CompileSwift failed with a nonzero exit code" error, we might find some information. In my case, I discovered that I had 3 files with the same name. Once I rectified this issue, everything started working as expected.

Alternatively, you can attempt the following steps:

  • Closing & Reopening Xcode
  • Cleaning Build Folder
  • Running pod install --repo-update
  • Restarting Mac


5

Solution to "Command CompileSwift Failed with a Nonzero Exit Code" Error in Xcode 10

The "Command CompileSwift Failed with a Nonzero Exit Code" error in Xcode 10 typically occurs when there's a compilation error in your Swift code that prevents the build process from completing successfully. This error can be caused by various issues, including syntax errors, missing files, or incompatible configurations.

To fix the "Command CompileSwift Failed with a Nonzero Exit Code" error in Xcode 10, you can try the following steps:

1. Check Swift Code:

Review your Swift code for any syntax errors, typos, or logical mistakes. Pay attention to error messages and warnings provided by Xcode's compiler to identify and resolve issues in your code.

2. Verify File References:

Check that all Swift source files are properly referenced and included in your Xcode project. Check for missing or corrupted files and re-add them if necessary.

3. Clean Build:

Perform a clean build by deleting the derived data folder and cleaning the build folder in Xcode. This can help clear any cached build artifacts and resolve issues related to intermediate files.

4. Update Xcode and Dependencies:

Make sure you're using the latest version of Xcode 10 and update any dependencies or third-party frameworks in your project to ensure compatibility.

5. Reset Xcode Settings:

If other solutions don't work, you can try resetting Xcode settings to their default values. This can help resolve configuration-related issues that might be causing the compilation error.


6

If you're facing this issue, consider changing the Compilation Mode setting for your project from Incremental to Whole Module. This adjustment fixed the problem for me.

Enabling Whole Module mode allowed the compiler to provide more specific error messages, making it easier to identify and address the issues in the code. Once you've resolved the errors, you can switch back to Incremental mode, if desired.

Additionally, check if you have any storyboard references to another storyboard that you've removed. Deleting such references can serve as a quick fix for the problem.


7

If you're encountering the same issue in Xcode 10 and none of the provided solutions are working, here are a couple more options to consider:

Firstly, try deleting all the files and folders located in the following directory:

~/Library/Developer/Xcode/DerivedData

This approach worked like a charm for me.

In another scenario where I encountered the error, I had used the "Refactor to Storyboard" function in Xcode. While it successfully created the new refactored storyboard, it failed to add it to the bundle resources.

To fix this issue, follow below steps:

  1. Select the target project in the Xcode Navigator.
  2. Choose the build phases tab.
  3. Expand Copy Bundled Resources to see if the new storyboard was added. If not, simply add it to the list and rebuild.