iOS预生成操作,根据Scheme更改plist值

我有一个iOS应用程序,它使用Agentry框架来定义要连接的Agentry服务器URL。 根据SAP规范,agentryServerURL参数包含在单独的branding.plist文件中。 我试图做的是绑定我的不同环境的iOSscheme到预生成的行动,以改变Agentry的URL值。

这是我目前的脚本,但它不工作。

#!/bin/sh plist=$SRCROOT"/branding.plist" if [ ${CONFIGURATION} = "DEV" ]; then /usr/libexec/PlistBuddy -c "Set :agentryServerURL https://smpdevURL" "$plist" if [ ${CONFIGURATION} = "QA" ]; then /usr/libexec/PlistBuddy -c "Set :agentryServerURL https://smpqaURL" "$plist" if [ ${CONFIGURATION} = "Release" ]; then /usr/libexec/PlistBuddy -c "Set :agentryServerURL https://smpprodURL" "$plist" fi 

这是我第一次编写预生成脚本,所以它可能是我的语法

尝试这个:

 #!/bin/sh plist="${SRCROOT}/branding.plist" if [ "${CONFIGURATION}" == "DEV" ]; then /usr/libexec/PlistBuddy -c "Set :agentryServerURL https://smpdevURL" "$plist" elif [ "${CONFIGURATION}" == "QA" ]; then /usr/libexec/PlistBuddy -c "Set :agentryServerURL https://smpqaURL" "$plist" elif [ "${CONFIGURATION}" == "Release" ]; then /usr/libexec/PlistBuddy -c "Set :agentryServerURL https://smpprodURL" "$plist" fi