Xcode - 如何使它对相同的代码库、不同的目标使用不同的 plist 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5682426/
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-14 20:50:31  来源:igfitidea点击:

Xcode - How to make it use different plist file for same code base, different targets

xcode

提问by Boon

I have a code base that I need to build out to two different targets. The only difference is they read different config.plists, config-1.plist for target #1 and config-2.plist for target #2. What do I need to do in the building to achieve this?

我有一个代码库,需要针对两个不同的目标进行构建。唯一的区别是它们读取不同的 config.plist,目标 #1 的 config-1.plist 和目标 #2 的 config-2.plist。我需要在建筑物中做什么才能实现这一目标?

回答by Martin Wickman

Like this:

像这样:

  • Select your project from the navigator to the left
  • Select the target you want to change (under TARGETS)
  • Click "Build Settings"
  • Search for "Info.plist"
  • 从左侧的导航器中选择您的项目
  • 选择要更改的目标(在 TARGETS 下)
  • 点击“构建设置”
  • 搜索“Info.plist”

In the Packaging section, you should see a setting called Info.plist file.

在 Packaging 部分,您应该看到一个名为Info.plist file的设置。

  • Change that to you "config-2.plist" or whatever you want.
  • 将其更改为“config-2.plist”或您想要的任何内容。

You also need to create the two plist-files of course.

当然,您还需要创建两个 plist 文件。