Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 239
Koen Avatar asked Aug 03 '15 11:08

Koen


People also ask

How do I add files to target in Xcode?

I include them in the project by right-clicking on the project folder in the project view in Xcode, and selecting "Add Files to ...". I then navigate to the folder containing the source files, click on the folder and select "Add." With the options "Create folder references" and "Add to target [target name]".

How do I add two GoogleService-info plist in Xcode?

In the Xcode project navigator, select the app target. Switch to the Build Phases tab at the top, then add a New Run Script Phase. Name the phase “Setup Firebase Environment GoogleService-Info. plist”, or something to that effect, and place it before the “Copy Bundle Resources” step.


2 Answers

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

like image 24
GraSim Avatar answered Sep 25 '22 08:09

GraSim


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.

like image 62
Daniel Hariri Avatar answered Sep 23 '22 08:09

Daniel Hariri