问题
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