Use different GoogleService-Info.plist for different build schemes Ask Question

Use different GoogleService-Info.plist for different build schemes Ask Question

I am using a build scheme for prod and one for staging (with 2 different bundle identifiers) and I am trying to use a separate GoogleService-Info.plist for each scheme. Is there any way to manually select the plist file to use when initialising GCM (and goole login)? Or is its possible to avoid using the plist and do the setup manually?

Thanks!

ベストアンサー1

Details

Tested on:

  • Xcode 9.2
  • Xcode 10.2 (10E125)
  • Xcode 11.0 (11A420a)

Solution

  1. Create folder with all your Google.plist files (with different names) in project

ここに画像の説明を入力してください

  1. Add run script

ここに画像の説明を入力してください

Do not forget to change PATH_TO_GOOGLE_PLISTS value

Code

PATH_TO_GOOGLE_PLISTS="${PROJECT_DIR}/SM2/Application/Firebase"

case "${CONFIGURATION}" in

   "Debug_Staging" | "AdHoc_Staging" )
        cp -r "$PATH_TO_GOOGLE_PLISTS/GoogleService-Info-dev.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" ;;

   "Debug_Production" | "AdHoc_Production" | "Distribution" | "Test_Production" )
        cp -r "$PATH_TO_GOOGLE_PLISTS/GoogleService-Info-prod.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" ;;

    *)
        ;;
esac

Build schemes names

ここに画像の説明を入力してください

おすすめ記事