3

I have an iOS app with 2 different configurations (prod and dev) and with 12 targets. My question is: how do you manage GoogleService-Info.plist file since each target needs one with a different configuration for that target (different bundle ids) and each target needs two different configurations depending on the environment (different environments means different databases: prod and dev).

The only solution I came up with is to keep one GoogleService-Info.plist file in the project and to add a run script and inject values for each target. Any thought on this?

There is a similar question but what's different here is that I have not just multiple environments but multiple targets as well.

UPDATE: If anybody needs the answer how I solved it: I added empty GoogleService-Info.plist file to the project and assigned it to all the targets. On each target, I added run script to inject appropriate values using PlistBuddy. That's how I deal with multiple targets. For multiple environments, I check configuration parameter in my run scripts and depending on that I inject different values. Cheers!

Ivan
  • 264
  • 3
  • 14

1 Answers1

8

Each target can have it owns files. What i mean is grab a PList from firebase for each different data base you want. In your case will be 12x2.

Add all of them to your project. And on this part (image), select only one different target for each PList. Consider having 2 target Prod and Dev for each one.

enter image description here

alegelos
  • 2,308
  • 17
  • 26
  • Thanks for the answer. I was thinking about that but adding additional 12 targets would lead to having 24 targets which I'd like to avoid. – Ivan Nov 02 '17 at 12:32
  • What about create a Pod (framework) of the share code in ir project. Split the project in many, all using ur pod. Not sure if it applies to ur needs. – alegelos Nov 02 '17 at 12:35
  • Firebase says that file must be named specifically google-services.plist and must be in the root of project. There is no way you can multiple files with same name in one folder. How did you overcome this? – Luten Oct 16 '20 at 10:53
  • Same is but different targets then no problem. Location no problem also. How can I help you? – alegelos Oct 16 '20 at 10:56