Skip to content

Instantly share code, notes, and snippets.

@Hazer
Last active November 22, 2023 22:23
Show Gist options
  • Save Hazer/5c5d77d941a502be0e4b4203457dcc4e to your computer and use it in GitHub Desktop.
Save Hazer/5c5d77d941a502be0e4b4203457dcc4e to your computer and use it in GitHub Desktop.
iOS GoogleServices-Info.plist per app flavor

iOS GoogleServices-Info.plist per app flavor

Create a new build phase

Create a new build phase, run script, make sure to move it to the top, you may name it something like "Copy Google-Services plist", and use the following content:

PATH_TO_CONFIG=$SRCROOT/Configs/GoogleService-Info-$CURRENT_FLAVOR.plist
# https://github.com/firebase/firebase-ios-sdk/issues/11400#issuecomment-1609413066
GSPLIST_FOLDER="$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/"
mkdir -p "$GSPLIST_FOLDER"
cp $PATH_TO_CONFIG "$GSPLIST_FOLDER/GoogleService-Info.plist"

Configure input file to:

$(SRCROOT)/Configs/GoogleService-Info-$(CURRENT_FLAVOR).plist

Configure output file to:

$(BUILT_PRODUCTS_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment