user187676
user187676

Reputation:

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?

Upvotes: 7

Views: 3952

Answers (2)

bikram990
bikram990

Reputation: 1115

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.

Upvotes: 3

user187676
user187676

Reputation:

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.

Upvotes: 6

Related Questions