I have a problem that I can't figure out, and I've searched everywhere.
I recently added Google Sign-in to my app, and it's working fine on the main target, however, since I'm using multiple targets to deploy a secondary version of my app, the second bundle identifier can't get added to "GoogleService-Info.plist". The Google sign-in code refers to this file by name, so I can't simply change the name for each version of the app like I've done for other plists.
I've tried adding environment variables to each scheme and using ${BUNDLE_ID} in the plist to change based on the chosen scheme, but it's not working either. Is there something I'm missing? How should a workspace with multiple targets use the same plist with different variables for each target?
Thanks!
Edit: Tried using an XCConfig file to replace the static values in the plist with compile-time variables. No luck, probably because I think Google Sign-in is accessing the file directly. I assume anyone using Google Sign-in with an app that has multiple targets (ad-supported vs. paid premium) must have a way around this. Please help.
I had the same problem and I found a pretty simple solution.
Just copy the GoogleServices-Info.plist and put it in a different folder. The folder must be a physically different folder, since the filesystem won't accept same file names in the same folder. So create a real folder in finder and add it to XCode, don't use XCode groups.
Then change the target membership according to each plist file. Thats it!


If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With