XCodeBuild -exportArchive wont allow me to specify filename

六眼飞鱼酱① 提交于 2019-12-10 04:18:55

问题


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://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.


回答1:


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




回答2:


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.




回答3:


If you do a xcodebuild --help it says:

-exportPath PATH specifies the destination for the product exported from an archive

hmmm.

To do a workaround you can rename your file afterwards.

mv "oldname" "newname"


来源:https://stackoverflow.com/questions/39831218/xcodebuild-exportarchive-wont-allow-me-to-specify-filename

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!