Managing Multiple GoogleService Info Plists In Xcode

3 min readFeb 28, 2024


When you go to add a Firebase configuration file into your iOS project you’ll find that Google explains the most basic use case but says nothing about more advanced configurations. From their documentation they outline a two-step process:

Their documentation even says “if prompted, select to add the config file to all targets” which… depends. There is a blurb at the bottom which touches on the problem

If you have multiple bundle IDs in your project, you must associate each bundle ID with a registered app in the Firebase console so that each app can have its own GoogleService-Info.plist file.

Then they don’t talk at all about how you would go about doing that!

“GLHF — XO Google”

Here’s what I did

Initial Setup

Choose your bundle identifiers. Example: “com.example.debug” for your Debug configuration and “com.example” for your Release configuration.

Initialize your firebase projects and apps (you may only have one project and two apps, or two projects each with one app — dont get me started on that one) and download your GoogleService-Info.plist files.

Setup Xcode

Create a Firebase folder inside your target directory. Copy your GoogleService files into your new Firebase folder. The names don’t matter — but choose identifiable names that make sense to you.

In Xcode navigate to Build Settings for your specific target. Add a user-defined setting named GOOGLESERVICE_PATH. Configure the value for each setting as the local path to the google service info plist file.

Navigate to Build Phases for your target. Create a new Run Script Phase. This script will copy the referenced GoogleService resource into the compiled app. The script will produce an error if the value of GOOGLESERVICE_PATH is empty, missing, or points to a location where the file does not exist

echo "Google Services Plist Path: ${GOOGLESERVICES_PATH}"

if [ -z "${GOOGLESERVICES_PATH}" ]; then
echo "GOOGLESERVICES_PATH is unset or set to the empty string"
exit 1

if [ ! -f "${GOOGLESERVICES_PATH}" ]; then
echo "GOOGLESERVICES_PATH does not exist"
exit 2


echo "Copied ${GOOGLESERVICES_PATH} to final destination: ${PLIST_DESTINATION}"

Access The Value From Fastlane

You can read the value of the xcode build setting (the local path to your GoogleService-Info.plist file) using xcode_build_setting

Add the fastlane plugin to your Gemfile

gem "fastlane-plugin-xcode_build_setting", git: ''

Run the fastlane action provided by the plugin

project: 'Firetruck.xcodeproj', # path to your xcode project
target: 'Firetruck', # the name of your target
configuration: 'Debug', # xcode configuration
key: 'GOOGLESERVICES_PATH' # name of your user defined build setting key

# Display the result
UI.message lane_context[SharedValues::XCODE_BUILD_SETTING_VALUE]

If the other fastlane actions you want to run only require a path to your GoogleService-Info.plist file — your work is done. If you’d like to read values from inside the plist file you can use `google_services_plist_values`

Add the plugin to your Gemfile

gem 'fastlane-plugin-google_services', git: ''

Run the fastlane action provided by the plugin

path: lane_context[SharedValues::XCODE_BUILD_SETTING_VALUE]

# Display the Google App Id
UI.message lane_context[SharedValues::GOOGLE_SERVICES_PLIST_VALUES_GOOGLE_APP_ID]




Smart enough to know better. Dumb enough to try it anyway.