使用存档时忽略 xcodebuild 参数 [英] xcodebuild arguments ignored when using archive

查看:18
本文介绍了使用存档时忽略 xcodebuild 参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的名字是 Luca,我目前致力于 iOS 持续集成,以使用 shell 脚本在 xcode 中构建应用程序以进行分发(Ad Hoc 和 App Store).

My name is Luca and I am currently working on iOS continuous integration to build apps in xcode for distribution (Ad Hoc and App Store) using shell-scripting.

到目前为止,我使用 IPA 文件取得了不错的效果.我的问题是在 App Store 中分发.要从脚本构建 .app(传递一些参数),我会这样做:

So far I achieved good results with IPA files. My problem comes for distribution in App Store. To build a .app from script (passing some arguments) I do:

xcodebuild -scheme myScheme -configuration myConfiguration PRODUCT_NAME=myProductName TARGETED_DEVICE_FAMILY=myTargetedDeviceFamily .... etc

自从使用 XCode 4.2 以来,应用程序提交是使用 XCode 管理器窗口完成的,我还必须能够存档我的可执行文件.

Since with XCode 4.2, apps submission is done using the XCode Organizer Window I must be able also to archive my executable.

因此我将之前的命令行修改如下:

Therefore I modify the previous command line as follow:

xcodebuild -scheme myScheme -configuration myConfiguration PRODUCT_NAME=myProductName TARGETED_DEVICE_FAMILY=myTargetedDeviceFamily .... etc      **archive**

不幸的是,在我这样做之后,似乎存档"参数强制 xcodebuild 忽略其他参数(PRODUCT_NAME、TARGETED_DEVICE_FAMILY、....),并且我的输出是使用 XCode 预定义构建设置构建的.

Unfortunately after I do so, it seems that the 'archive' argument force xcodebuild to ignore the other ones (PRODUCT_NAME, TARGETED_DEVICE_FAMILY, ....) and my output is built using the XCode predefined build settings.

我希望能够通过 xcodebuild 传递参数并使其有效,但归档"操作似乎阻止了这一点.

I want to be able to pass the arguments with xcodebuild and be effective, but the 'archive' action seems to prevent this.

我快疯了,请帮忙:)

谢谢

推荐答案

xcodebuild 的 archive 操作似乎在 Xcode 4.2 中存在错误.通常,可以将项目配置的覆盖指定为命令行参数或通过 -xcconfig 参数.

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.

尽管 build 操作会尊重他们,archive 不会.(大概这是因为存档是内部调用构建的元操作,但不会将选项传递给内部调用.)有一个 OpenRadar 错误 描述了此问题,因此大概已报告给 Apple.

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.

最后,请注意,如果您要使用脚本中的 archive 操作,则不能依赖 xcodebuild 的退出代码.归档操作总是产生 0 的退出代码(成功,按照惯例).要检测构建失败,您需要抓取输出.

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.

这篇关于使用存档时忽略 xcodebuild 参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆