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

IosXcodeSwiftGoogle AnalyticsSdk

Ios Problem Overview


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

> 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.

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?

Thanks!

Ios Solutions


Solution 1 - Ios

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.

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

Solution 2 - Ios

Physically drag 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)

enter image description here

Solution 3 - Ios

In Xcode 6 Follow the step sequence in this digram.

  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)

enter image description here

Solution 4 - Ios

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

enter image description here

Solution 5 - Ios

Update for Xcode 12.3:

It should be selected automatically, but check anyway:

ce you drag the file to the root dir, select it and on the very right hand side you will see Target membership, make sure all the targets are selected.

Solution 6 - Ios

It is important to note that GoogleService-Info.plist file should be added to xCode i.e. open your xCode and drag the file to Runner > Runner.

Then click on GoogleService-Info.plist. On the right side of he screen you can find Target Membership.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKoenView Question on Stackoverflow
Solution 1 - IosDaniel HaririView Answer on Stackoverflow
Solution 2 - IosGraSimView Answer on Stackoverflow
Solution 3 - IosChathura PalihakkaraView Answer on Stackoverflow
Solution 4 - IosRobView Answer on Stackoverflow
Solution 5 - IosElKePoNView Answer on Stackoverflow
Solution 6 - IosUjjwal RaijadaView Answer on Stackoverflow