ios 如何将 .plist 文件添加到 Xcode 中的所有目标?

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

How to add .plist file to all targets in Xcode?

iosxcodeswiftgoogle-analyticssdk

提问by Koen

Totally new to iOS but I'm currently trying to setup Google Analytics. I have followed the SDK documentationand everything went great until this step:

对 iOS 完全陌生,但我目前正在尝试设置 Google Analytics。我遵循了 SDK 文档,直到这一步之前一切都很好:

Add the configuration file to your project

Drag the GoogleService-Info.plist file you just downloaded into the root of your Xcode project and add it to all targets.

将配置文件添加到您的项目中

将刚刚下载的 GoogleService-Info.plist 文件拖到 Xcode 项目的根目录中,并将其添加到所有目标中。

It doesn't say anything on HOW to add it to all targets. Being new to Xcode and iOS in general, I'm completely lost. Anyone with an answer for me?

它没有说明如何将其添加到所有目标。作为 Xcode 和 iOS 的新手,我完全迷失了。有没有人给我一个答案?

Thanks!

谢谢!

回答by Daniel Hariri

Select the GoogleService-Info.plist in the project navigator(the file hierarchy on the left side of Xcode). Then, if it isn't open yet, open the utilities bar(click the top-right most button in Xcode). You will see a section 'Target Membership'. Check all the checkboxes to add the .plist to all targets.

在项目导航器(Xcode 左侧的文件层次结构)中选择 GoogleService-Info.plist。然后,如果它尚未打开,请打开实用工具栏(单击 Xcode 中最右上角的按钮)。您将看到“目标会员”部分。选中所有复选框以将 .plist 添加到所有目标。

In most cases it is enough to just add the file to your project.

在大多数情况下,只需将文件添加到您的项目中就足够了。

回答by GraSim

Physicallydrag the GoogleService-Info.plist file from your download folder ( or wherever you saved it) to your main project directory as shown below. Once you do that, the "Targets" dialog should open automatically and you can choose all targets (...click on all the targets shown)

将 GoogleService-Info.plist 文件从您的下载文件夹(或您保存它的任何位置)物理拖动到您的主项目目录,如下所示。完成此操作后,“目标”对话框应自动打开,您可以选择所有目标(...单击显示的所有目标)

enter image description here

在此处输入图片说明

回答by Rob

If you select the plist in question and then go to the file inspector (press command+option+1or select the first tab on the right panel), you can select on which targets you wish to include it:

如果您选择有问题的 plist,然后转到文件检查器(按command+ option+1或选择右侧面板上的第一个选项卡),您可以选择要包含它的目标:

enter image description here

在此处输入图片说明

回答by Chathura Palihakkara

In Xcode 6 Follow the step sequence in this digram.

在 Xcode 6 中按照此图中的步骤顺序进行操作。

  1. First select your target.
  2. Select build settings tab.
  3. Search for "info.plist file"
  4. Edit the value for key "info.plist file" (Add the actual plist path in step 4)
  1. 首先选择你的目标。
  2. 选择构建设置选项卡。
  3. 搜索“info.plist 文件”
  4. 编辑键“info.plist 文件”的值(在步骤 4 中添加实际的 plist 路径)

enter image description here

在此处输入图片说明