Search code examples
iosxcodexcodebuild

xcodebuild archives all targets instead of one


I need to archive a specific scheme from my xcodeproj. To do this I run

xcodebuild archive \
    -scheme $SCHEME \
    -target $TARGET \
    -archivePath $ARCHIVE_PATH

Although I explicitly define a scheme and target, the resulting xcarchive contains both targets and the follow-up IPA export call complains with

error: the archive at path '<path>.xcarchive' is not a single-bundle archive
** EXPORT FAILED **

Why does xcodebuild produce an archive with multiple bundles?


Solution

  • It was a problem with the project's schemes. I created new Schemes by duplicating the original one instead of adding a new one. The resulting scheme then listed 2 targets in the build section instead of one (only god knows why) and Xcode would not let me remove the other target.

    Once I removed all schemes and created them from scratch everything worked just fine.