Skip to content

Instantly share code, notes, and snippets.

@AndresR173
Created July 26, 2020 20:35
Show Gist options
  • Save AndresR173/09c64a287b982927d756ca74ad80e3d3 to your computer and use it in GitHub Desktop.
Save AndresR173/09c64a287b982927d756ca74ad80e3d3 to your computer and use it in GitHub Desktop.
Copy Google-Services.plist into Xcode project from Flutter projects
# Type a script or drag a script file from your workspace to insert its path.
environment=${ASSET_PREFIX}
# Name and path of the resource we're copying
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist
GOOGLESERVICE_INFO_FILE=${PROJECT_DIR}/Google/${environment}/${GOOGLESERVICE_INFO_PLIST}
# Make sure GoogleService-Info.plist exists
echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_FILE}"
if [ ! -f $GOOGLESERVICE_INFO_FILE ]
then
echo "No GoogleService-Info.plist found. Please ensure it's in the proper directory."
exit 1
fi
# Get a reference to the destination location for the GoogleService-Info.plist
# This is the default location where Firebase init code expects to find GoogleServices-Info.plist file
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
echo "Will copy ${GOOGLESERVICE_INFO_PLIST} to final destination: ${PLIST_DESTINATION}"
# Copy over the prod GoogleService-Info.plist for Release builds
cp "${GOOGLESERVICE_INFO_FILE}" "${PLIST_DESTINATION}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment