Xcode 将 ${PRODUCT_NAME} 存储在文件系统的什么位置?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22693261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:49:11  来源:igfitidea点击:

Where does Xcode store ${PRODUCT_NAME} on the file system?

iosxcodemacosxcodebuild

提问by nburk

Referring to this questionwhere it was asked where to find ${PRODUCT_NAME} in Xcode itself, I would like to know where (so in which file) Xcode stores the value of the ${PRODUCT_NAME} on the file system?

参考这个问题,它被问到在哪里可以找到 Xcode 本身的 ${PRODUCT_NAME},我想知道 Xcode 在哪里(那么在哪个文件中)存储 ${PRODUCT_NAME} 在文件系统上的值?

I want to write a build script that is able to automatically access this variable and change the product name without using Xcode.

我想编写一个构建脚本,该脚本能够在不使用 Xcode 的情况下自动访问此变量并更改产品名称。

回答by David Berry

It's in MyProject.xcodeproj/project.pbxproj.

它在 MyProject.xcodeproj/project.pbxproj 中。

Although in this case you'll probably find you're better served by not actually changing the PRODUCT_NAME, but by changing whatever it is you're using PRODUCT_NAME for. Even then you'll probably find that the best approach is to use an .xcconfig file, which has a public format instead of the pbxproj file which has a rather arcane NextStep format.

尽管在这种情况下,您可能会发现实际上不更改 PRODUCT_NAME 会更好地为您服务,而是更改您使用 PRODUCT_NAME 的目的。即便如此,您可能会发现最好的方法是使用具有公共格式的 .xcconfig 文件,而不是具有相当神秘的 NextStep 格式的 pbxproj 文件。

回答by htafoya

On Xcode 9.0 you can go to your main project settings > Build Settings and in the search bar find Product Name.

在 Xcode 9.0 上,您可以转到主项目设置 > 构建设置,然后在搜索栏中找到Product Name

You will have an input field to change this value.

您将有一个输入字段来更改此值。