Use User-Defined build settings in custom .plist file

后端 未结 4 1612
感动是毒
感动是毒 2020-12-24 14:22

I have different build configurations (Debug, Stage, Prod) defined for my app and I use User-Defined build settings:

to set up Facebook log

4条回答
  •  春和景丽
    2020-12-24 15:03

    Actually there's a better solution.

    You can replace Env variables(including User-Defined) manually using my swift script.

    It takes two arguments: input and output paths. Goes through all input plist values recursively (if you need to can add dict keys to be processed too), and replaces all Env variables it founds. And writes to output path.

    This is how you use it in your Run script phase:

    /usr/bin/xcrun --sdk macosx swift "${PROJECT_DIR}/scripts/replacePlistEnvironmentVariables.swift"  "${PROJECT_DIR}/GoogleService-Info.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist"
    

提交回复
热议问题