在 iOS XCode 项目中更改产品名称宏
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7016788/
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
Change product name macro in iOS XCode project
提问by JoJo
I built my iPhone code atop Apple's sample project. It names the app "LazyTable" when placed on the home screen on iPhone. I would like to change this name. If I go to info.plist and manually type in a new name into the Bundle display name
key, it works. But I don't want to hardcode because the PRODUCT_NAME
is used in many places.
我在Apple 的示例项目之上构建了我的 iPhone 代码。当放置在 iPhone 的主屏幕上时,它将应用程序命名为“LazyTable”。我想更改此名称。如果我转到 info.plist 并在Bundle display name
密钥中手动输入一个新名称,它会起作用。但我不想硬编码,因为PRODUCT_NAME
在很多地方都使用了。
Info.plist
信息表
So I go into Project > Edit Project Settings to change the macro. I close the window, clean, and rebuild. The app name is still stuck with "LazyTable"! How do I make this change to the macro take effect?
所以我进入项目>编辑项目设置来更改宏。我关上窗户,清洁并重建。应用名称仍然卡在“LazyTable”上!如何使对宏的此更改生效?
Project Info
项目信息
回答by memmons
The approach you are using is correct. However, remember that each target can have their own settings that will override the project settings. Make sure the target does not override PRODUCT_NAME.
您使用的方法是正确的。但是,请记住,每个目标都可以有自己的设置来覆盖项目设置。确保目标不会覆盖 PRODUCT_NAME。
To do this, select the project in the Xcode project browser, then select the target. Each target has it's own build settings. Change the PRODUCT_NAME just as you would when editing the project build settings.
为此,请在 Xcode 项目浏览器中选择项目,然后选择目标。每个目标都有自己的构建设置。就像在编辑项目构建设置时一样更改 PRODUCT_NAME。