Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 261
Era Avatar asked Feb 02 '15 09:02

Era


2 Answers

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.

like image 88
Era Avatar answered Sep 21 '22 18:09

Era


One more scenario when this happens is when your sub-project(Target dependency) has Skip Install set to No in build settings.

To find which sub-project, check the content inside the archive. Products folder should have only one product.

In my case a sub-project was a dynamic library and was added in the archive under /<path to archive>/Products/usr/lib/<library> path.

like image 21
bikram990 Avatar answered Sep 19 '22 18:09

bikram990