14
votes

I'm trying to generate an xcarchive using xcodebuild that I can later export as an .ipa using the new functionality added with Xcode 5.

This works perfectly fine:

xcodebuild -workspace 'MyWorkspace.xcworkspace' -scheme 'MyScheme' -configuration 'Release' -archivePath tmp.xcarchive archive
xcodebuild -exportArchive -exportFormat IPA -archivePath tmp.xcarchive -exportPath app.ipa -exportWithOriginalSigningIdentity

But as soon as I add custom build settings to the archive command:

-derivedDataPath build SYMROOT=build/build.sym DSTROOT=build/build.dst OBJROOT=build/build.obj SHARED_PRECOMPS_DIR=build/build.pch

The .xcarchive generated is empty, but there is no error.

Any ideas?

4
Unfortunately no ideas and no documentation how this **** exactly works :/ - Opal
There's a developer thread about it: devforums.apple.com/thread/255330 - OrangeDog
was this ever solved? - Rafthecalf

4 Answers

4
votes

For me, this had to do with the Installation Directory Deployment Build Setting in Xcode: CMake somehow set this to "", i.e. an empty string, when it should have been "/Applications", the Xcode default. For me, setting it to anything else than "/Applications" caused the resulting archive to be empty and therefore 'malformed'.

So maybe your project somehow did not have Installation Directory set to "/Applications", either because of CMake or something else.

To set this using CMake, add this to your target properties:

set_target_properties(${MODULE} PROPERTIES
     ...
     XCODE_ATTRIBUTE_INSTALL_PATH "/Applications"
     ...
)
3
votes

For me this error happened when I had no space left on the drive where I tried to create the archive. But I could not tell that from the errors int he console

0
votes

In my case the 'archivepath' directory/file path was incorrectly set in previous steps, and it was looking into a directory which did not have .xcarchive file. Worth checking manually the paths and if the archive file exists in the directory

0
votes

In my case, I was missing the .xcarchive extension at the end of my path.

xcodebuild -exportArchive -archivePath /<path_to_archive>/file.xcarchive ...