Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcodebuild archive generates malformed xcarchive when adding custom build settings

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?

like image 500
Erik Sundin Avatar asked Mar 12 '14 11:03

Erik Sundin


People also ask

What is Xcarchive file?

Application archive created by Xcode, Apple's development IDE for Mac OS X and iOS applications; stores all application files in a format that can be submitted to the App Store for review; contains a digital signature identifying the developer.

How do I make an IPA from Xcarchive?

Now you have to do below steps: Go to Window->Organiser->Archives Here, select your archive fine and click on "Distribute App" button on right side Then Instead of upload, select Export option, and continue selecting default options, it will end you up with generating ipa file.

How do I create an archive in Xcode?

Archive your App In Xcode with your project open, select the simulator (button near the top of the window next to your project name, typically named as a specific type of iPhone) – change it to Generic iOS Device. Open the Product menu and choose Archive. You will see the archive information. Click Validate App.


1 Answers

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"
     ...
)
like image 188
fabian789 Avatar answered Sep 25 '22 18:09

fabian789