-
-
Save tylermilner/f8e9121d62c890cb707bc1810a7d57d9 to your computer and use it in GitHub Desktop.
# 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/Dev/${GOOGLESERVICE_INFO_PLIST} | |
GOOGLESERVICE_INFO_PROD=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Prod/${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 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}" | |
else | |
echo "Using ${GOOGLESERVICE_INFO_DEV}" | |
cp "${GOOGLESERVICE_INFO_DEV}" "${PLIST_DESTINATION}" | |
fi |
Hi I am having an issue when i integrated this script and used the approach you suggested into my existing project . The issue is as follows
error: Could not get GOOGLE_APP_ID in Google Services file from build environment
When targeting watchos
use:
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.appex
Hi @tylermilner . This is save my day. Can you explain why set PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
and not the other? Where is ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
location in my project?
Hi I am having an issue when i integrated this script and used the approach you suggested into my existing project . The issue is as follows error: Could not get GOOGLE_APP_ID in Google Services file from build environment
Faced same problem. You must change the order of run script and try again. It will be fixed.
is there any solution for Could not get GOOGLE_APP_ID in Google Services file from build environment?
This script and the article in Medium are great.
I had to change the script to handle mac app as well - the target location is different, so I added the following