开发者

xcodebuild PRODUCT_NAME argument affects all targets

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 xc开发者_如何学Pythonode 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).

Is this expected behavior?


How I fixed this:

  1. Add CUSTOM_BUNDLE_IDENTIFIER and CUSTOM_PRODUCT_NAME under the user defined section of build settings.
  2. Add a .xcconfig file to the project with CUSTOM_PRODUCT_NAME, and CUSTOM_BUNDLE_IDENTIFIER set to the nominal values.
  3. Set the product name to ${CUSTOM_PRODUCT_NAME} and bundle name to ${CUSTOM_BUNDLE_IDENTIFIER} in the info.plist.
  4. Set the Product Name to ${CUSTOM_PRODUCT_NAME} under build settings.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜