xcodebuild arguments ignored when using archive

橙三吉。 提交于 2019-11-29 13:41:55

The archive action for xcodebuild seems to have a bug in Xcode 4.2. Normally overrides for the project configuration can be specified as either command-line parameters or via the -xcconfig parameter.

Although the build action honors them, archive does not. (Presumably this is because archive is a meta-action that invokes build internally, but doesn't pass-through the options to the internal invocation.) There is an OpenRadar bug that describes this issue, so presumably it's been reported to Apple.

Finally, note that if you're going to use the archive action from a script then you can't rely on the exit code from xcodebuild. The archive action always yields an exit code of 0 (success, by convention). To detect build failure you need to scrape the output.

I've ran into this same issue. My current work-around is basically to delete the other configurations so archive is forced to use the one you want. Not really a solution that can be done via command-line, hopefully Apple will fix this glaring issue.

this may be too late for the original poster, but may help others. for my build process, i use xcodebuild to with first clean and then build, then i use xcrun to create the archive:

 /usr/bin/xcrun -sdk iphoneos PackageApplication -v "build/<Path_to_build_dir>/<App_Name>.app" -o "<Path_to_archive_output>.ipa" --sign "<signing identity>" --embed "<path to provision profile>.mobileprovision"

with this command, i can create an archive for the app store, or even upload an ad-hoc build to TestFlight like this:

curl http://testflightapp.com/api/builds.json \
    -F file="<path to archive>" \
    -F api_token='<api token>' \
    -F team_token='<team token>' \
    -F notes='Automated build'  \
    -F notify=True \
    -F distribution_lists='me'

this works as of xcode 6.1

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