xcodebuild PRODUCT_NAME 参数影响所有目标 [英] xcodebuild PRODUCT_NAME argument affects all targets

查看:31
本文介绍了xcodebuild PRODUCT_NAME 参数影响所有目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从命令行运行 xcodebuild,并且经常更改 PRODUCT_NAME 以区分版本和服务器端点(即 MyProduct.r1234staging).这会构建几个依赖目标,它们是静态库,然后是最终的应用程序.在命令的 xcode 3 版本中,PRODUCT_NAME 仅影响最终产品,而不影响库.但是,现在似乎也在为这些库设置这些名称(即构建 libMyProduct.r1234staging.a).

I am running xcodebuild from the command line, and frequently I change the PRODUCT_NAME to distinguish between versions and server endpoints (ie MyProduct.r1234staging). This builds several dependent targets which are static libraries, and then the final application. In the xcode 3 version of the command, the PRODUCT_NAME only affected the final product, not the libraries. However it now seems to be setting those names for the libraries as well (ie building libMyProduct.r1234staging.a).

这是预期的行为吗?

推荐答案

我是如何解决这个问题的:

How I fixed this:

  1. 在构建设置的用户定义部分下添加 CUSTOM_BUNDLE_IDENTIFIER 和 CUSTOM_PRODUCT_NAME.
  2. 将 .xcconfig 文件添加到带有 CUSTOM_PRODUCT_NAME 的项目,并且CUSTOM_BUNDLE_IDENTIFIER 设置为标称值.
  3. 在 info.plist 中将产品名称设置为 ${CUSTOM_PRODUCT_NAME},将包名称设置为 ${CUSTOM_BUNDLE_IDENTIFIER}.
  4. 在构建设置下将产品名称设置为 ${CUSTOM_PRODUCT_NAME}.

当我想更改某些值时,我会创建一个新的 xcconfig 文件,并使用 xcodebuild 的 -xcconfig 参数指定该 xcconfig 文件.这允许您即时更改设置.

When I want to change some of the values I create a new xcconfig file, and specify that xcconfig file using the -xcconfig param for xcodebuild. This allows you to change the settings on the fly.

这篇关于xcodebuild PRODUCT_NAME 参数影响所有目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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