Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCodeBuild -exportArchive wont allow me to specify filename

I'm busy working on a Jenkins build that will be building iOS applications. I have managed to create an archive successfully with this command:

xcodebuild archive -archivePath build/app.xcarchive 

Now I'm trying to export that archive with specifying the output file name, but can't get this to work.In the example below I want an output file called app.ipa, but all I get is a folder called app.ipa with an ipa file inside name .ipa

xcrun xcodebuild -exportArchive -exportPath build/app.ipa -archivePath build/app.xcarchive/ -exportOptionsPlist exportOptions.plist

Outputs a file /build/app.ipa/<projectname>.ipa

Apples documentation for XCodeBuild says that you can specify the output path including file name:

-exportPath destinationpath Specifies the destination for the exported product, including the name of the exported file.

https://web.archive.org/web/20170620204608/https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html

The reason for this is that I would like to keep the build generic so that any project I send through it will result in an app.ipa without me needing to keep track of project names and different output files etc.

like image 524
Craigt Avatar asked Oct 03 '16 12:10

Craigt


2 Answers

This is filed as a bug in open radar: "xcodebuild exportArchive -exportPath" does not write what it's documented to write

like image 194
mbi Avatar answered Nov 16 '22 01:11

mbi


For XCode 11 and earlier:

ArchiveAction tag in .xcscheme file can have attribute customArchiveName which can be set to anything you like.

   <ArchiveAction
      buildConfiguration = "AdHoc_Example"
      customArchiveName = "app"
      revealArchiveInOrganizer = "YES">
   </ArchiveAction>
</Scheme>

This will give you app.ipa always when you export the archive through -exportOptionsPlist.

like image 31
RAM237 Avatar answered Nov 16 '22 01:11

RAM237