Last active
March 30, 2020 22:14
-
-
Save anhtuank7c/411c94a4e99578a9d9531fef7b7b250e to your computer and use it in GitHub Desktop.
Setup Firebase Environment GoogleService-Info.plist, https://medium.com/rocket-fuel/using-multiple-firebase-environments-in-ios-12b204cfa6c0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name of the resource we're selectively copying | |
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist | |
# Get references to dev and prod versions of the GoogleService-Info.plist | |
# NOTE: These should only live on the file system and should NOT be part of the target (since we'll be adding them to the target manually) | |
GOOGLESERVICE_INFO_DEV=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Debug/${GOOGLESERVICE_INFO_PLIST} | |
GOOGLESERVICE_INFO_STAGING=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Staging/${GOOGLESERVICE_INFO_PLIST} | |
GOOGLESERVICE_INFO_PROD=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Release/${GOOGLESERVICE_INFO_PLIST} | |
# Make sure the dev version of GoogleService-Info.plist exists | |
echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_DEV}" | |
if [ ! -f $GOOGLESERVICE_INFO_DEV ] | |
then | |
echo "No Development GoogleService-Info.plist found. Please ensure it's in the proper directory." | |
exit 1 | |
fi | |
# Make sure the staging version of GoogleService-Info.plist exists | |
echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_STAGING}" | |
if [ ! -f $GOOGLESERVICE_INFO_STAGING ] | |
then | |
echo "No Stating GoogleService-Info.plist found. Please ensure it's in the proper directory." | |
exit 1 | |
fi | |
# Make sure the prod version of GoogleService-Info.plist exists | |
echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_PROD}" | |
if [ ! -f $GOOGLESERVICE_INFO_PROD ] | |
then | |
echo "No Production 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 | |
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 | |
if [ "${CONFIGURATION}" == "Release" ] | |
then | |
echo "Using ${GOOGLESERVICE_INFO_PROD}" | |
cp "${GOOGLESERVICE_INFO_PROD}" "${PLIST_DESTINATION}" | |
elif [ "${CONFIGURATION}" == "Staging" ] | |
then | |
echo "Using ${GOOGLESERVICE_INFO_STAGING}" | |
cp "${GOOGLESERVICE_INFO_STAGING}" "${PLIST_DESTINATION}" | |
else | |
echo "Using ${GOOGLESERVICE_INFO_DEV}" | |
cp "${GOOGLESERVICE_INFO_DEV}" "${PLIST_DESTINATION}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment