Use different GoogleService-Info.plist for different build schemes

后端 未结 17 752
梦毁少年i
梦毁少年i 2020-12-07 07:49

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 t

17条回答
  •  日久生厌
    2020-12-07 08:23

    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_Poduction" | "AdHoc_Poduction" | "Distribution" | "Test_Poduction" )
            cp -r "$PATH_TO_GOOGLE_PLISTS/GoogleService-Info-prod.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" ;;
    
        *)
            ;;
    esac
    

    Build schemes names

提交回复
热议问题