Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use two different GoogleService-info.plist file in ios swift project for dev n prod?

I need to use two different GoogleService-info.plist for working with dev and prod builds, currently I'm separating dev and prod by just changing "build configuration" in edit scheme, but now I need to have two different .plist files for dev and prod for working with google analytics, pushwoosh etc,

like image 474
Harshad Madaye Avatar asked Sep 07 '16 05:09

Harshad Madaye


People also ask

How do I create a new plist in Xcode?

Right click on the folder you want to add it to and choose "New file…" This will bring up a blank file with columns for Key, Type and Value. Choose any of the presented options, you'll be overwriting it anyway. Now change the Key to "Apple".


1 Answers

For this case you need use different Targets with diff bundle id in project for Dev and Prod.
After that you will can link GoogleService-info.plist for this targets. And also I recommend create different folders in project directory Look at pictures. The first you create targets Prod and Dev

enter image description here

After create diff folders in project dict let's call them GoogleProd and GoogleDev and copy your .plist file to diff folders and drag to project. First file you need link with TestProd target

enter image description here

And the second file link with TestDev target

enter image description here

The final project directory will look like

enter image description here

like image 94
iSashok Avatar answered Oct 20 '22 18:10

iSashok