Info.plist文件中与配置有关的值 [英] Configuration dependent value in Info.plist file

查看:102
本文介绍了Info.plist文件中与配置有关的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iOS项目中有三种配置:

I have three configurations in my iOS project:

  1. 调试
  2. 即席
  3. 发布

现在,我要更改应用程序的名称,如下所示:

Now I want to change the name of the App as follows:

  1. MyAppDebug
  2. MyAppAdhoc
  3. MyApp (请注意,这个没有后缀)
  1. MyAppDebug
  2. MyAppAdhoc
  3. MyApp (Note that this one does not have a suffix)

是否可以通过某种"compiler-if-else-macro-thing" 类型轻松地在Xcode中实现此目标?

Is there a way I can easily achieve this in Xcode with some type of "compiler-if-else-macro-thing"?

推荐答案

更改相应配置的应用显示名称: 一种方法是使用与您相同的info plist文件.

Changing display name of app for respective configurations: one way to achieve this is by using the same info plist file that you have.

第1部分:创建用户定义的变量

  1. 单击目标项目文件.
  2. 然后在右下角找到按钮"+"添加构建设置.
  3. 单击该按钮添加构建设置",然后选择添加用户定义的 设置"为新设置输入名称,例如:"BUNDLE_DISPLAY_NAME".
  4. 展开此新设置以查看其下的配置.为每个配置指定要显示的名称. 例如:调试-> MyAppDebug
  1. Click on target project file.
  2. Then at bottom right corner locate button "+" Add Build Setting.
  3. Click that button "Add Build Setting" and select "Add User-Defined Setting" enter name for New Setting as for ex: "BUNDLE_DISPLAY_NAME".
  4. Expand this new setting to see the configurations under it. Give the desired name to be displayed for each configuration. For ex: Debug -> MyAppDebug

第2部分:使用

  1. 选择您的appname-info.plist文件.
  2. 找到键捆绑包显示名称"及其值应为此新的用户定义变量$ {BUNDLE_DISPLAY_NAME}

然后进行适当的配置,它将在构建设置中从BUNDLE_DISPLAY_NAME变量中选择名称.

Then for appropriate configuration it will select name from BUNDLE_DISPLAY_NAME variable in build settings.

这篇关于Info.plist文件中与配置有关的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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