Archiving your iOS app in Xcode is a critical step before submitting it to the App Store. However, this process can sometimes be fraught with errors. This blog post will help you troubleshoot and resolve common issues you may encounter during the archiving process.
Common Errors and How to Fix Them
1. Error: “Select Team”
Issue: Xcode is prompting you to select a development team.
Solution:
- Click on the error message in the Xcode build log.
- In the Signing & Capabilities tab, under the Team dropdown, ensure the correct team is selected .
2. Error: “Multiple Command Produce”
Issue: Xcode reports that multiple commands produce the same output file, commonly related to Pods.
Solution:
- Click on Pods in the Project Navigator.
- Use the filter function to search for accessibility.
- Remove the duplicate entry that does not have a version number (e.g., React-Core-accessibility).
Alert: Ensure you keep the folder named coremodulesHeaders and delete the other conflicting folder.
Video Tutorial:
3. Error: “PhaseScriptExecution Failed”
Issue: A script phase execution has failed during the build process.
Solution:
- Go to your Target > Build Settings.
- Locate the Excluded Architectures setting.
- Remove
arm64
from the excluded architectures list.
4. Error: “Command PhaseExecution failed with a nonzero”
Issue: A script phase execution has failed during upgrading Xcode version.
Solution:
- Go to your node_modules/react-native/scripts/find-node.sh.
- Replace set -e with set +e.
Additional Step for Xcode 15+:
- Go to Build Phases.
- Locate Bundle React Native Code and Images.
- Add the following export flag to handle the OpenSSL legacy provider issue:
set -e
export NODE_BINARY=node
export NODE_ARGS="--openssl-legacy-provider" # <~~~~~~ ADD THIS
../node_modules/react-native/scripts/react-native-xcode.sh
Video Tutorial:
Tips for Preventing Errors
- Keep Xcode Updated: Ensure you are using the latest version of Xcode to avoid compatibility issues.
- Regularly Update Dependencies: Regularly update your CocoaPods and other dependencies to their latest versions.
- Check Provisioning Profiles: Ensure your provisioning profiles are up-to-date and correctly configured.
Conclusion
Handling errors during the archiving process in Xcode can be challenging, but with these troubleshooting steps, you can resolve common issues effectively. By staying proactive and following these guidelines, you can ensure a smoother build and submission process for your iOS app. Happy coding!