15

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?

Erik Sundin
  • 151
  • 1
  • 4

4 Answers4

4

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"
     ...
)
fabian789
  • 8,348
  • 4
  • 45
  • 91
3

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

Johan
  • 318
  • 2
  • 9
1

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

xcodebuild -exportArchive -archivePath /<path_to_archive>/file.xcarchive ...
johnborges
  • 2,422
  • 20
  • 33
0

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

Naishta
  • 11,885
  • 4
  • 72
  • 54