Terlambat tetapi saya pikir saya harus memposting jawaban ini untuk membantu pengembang baru, saya menemukan artikel yang sangat bagus yang menjawab masalah saya dan saya berjanji itu dapat membantu Anda juga :)
Periksa artikel ini yang menyelesaikan masalah Anda juga.
Langkah 1:
Salin GoogleService-Info.plist yang sesuai dengan lingkungan pengembangan Firebase Anda ke dalam direktori Dev . Demikian pula, salin GoogleService-Info.plist yang sesuai dengan lingkungan produksi Firebase Anda di direktori Prod . Pastikan untuk menghapus centang "Salin item jika perlu" dan semua target di bawah "Tambahkan ke target" .
Langkah 2:
Di navigator proyek Xcode, pilih target aplikasi. Beralih ke tab Build Phases di bagian atas, lalu tambahkan New Run Script Phase . Beri nama fase "Setup Firebase Environment GoogleService-Info.plist" , atau sesuatu dari efek tersebut, dan letakkan sebelum langkah "Copy Bundle Resources" .
Langkah 3:
Terapkan skrip shell yang akan menyalin GoogleService-Info.plist yang sesuai ke dalam app bundle berdasarkan konfigurasi build. Salin dan tempel skrip shell berikut ke dalam fase skrip jalankan yang baru saja Anda buat:
# 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