others-how to solve 'Command PhaseScriptExecution failed with a nonzero exit code' when trying to add firebase crashlytics to your ios app ?

1. Purpose

In this post, I would demo how to solve the below error when trying to add firebase crashlytics to your ios app with swift in iOS developement:

When we add firebase crashlytics to our app, we followed the instructions from https://firebase.google.com/docs/crashlytics/get-started?platform=ios&authuser=0#add-sdk , which told us add a build script to our app’s run script:

image-20210425175432945

We got this error from xcode

Command PhaseScriptExecution failed with a nonzero exit code

And this error:

image-20210425175412371

2. Environment

xcode 12

swift 5

3. The reason

What is a build phase in xcode?

This build phase also lets you provide a list of input and output files. The script always runs when no input and output files are provided. When input and output files are provided, the script only runs if it has never been run before, one of the input files has changed, or one of the output files is missing.

If you are using cocoapods, you may not be required to have an additional run script .

4. The solution

So the solution is remove the script as follows:

image-20210425175642369

Now it works!

5. Summary

In this post, I demonstrated how to solve the Command PhaseScriptExecution failed with a nonzero exit code when using firebase crashlytics to our apps.