Error: Multiple commands produce…, Cocoapods & Multi Platform Podfiles
TL;DR: Remove use_frameworks!
from your Podfile
.
If you’ve arrived here you probably have a Podfile
that includes multiple targets for multiple platforms that share some pods, while using the new Xcode build system.
And you’re almost certainly ready to burn everything to the ground.
Thankfully, I already did that, and out of the ashes a solution emerged, resplendent and angry.
There are a couple of issues:
- Xcode is non deterministic with respect to this issue, and will randomly decide whether there is an issue to worry about at all. This is fucking infuriating.
The new build system (randomly, see 1!) doesn't like duplicate things, whereas the legacy build system didn't care.
When Swift was introduced, it didn’t support static libraries, so we all dutifully added
use_frameworks!
to ourPodfiles
. When you have multiple platforms sharing pods, you will have multiple copies of the pod source in yourPods/Target Support Files/
folder, and Xcode will get its knickers in a bunch. Sometimes.Swift now supports static libraries.
Remove
use_frameworks!
and everything will work.