iOS预构建操作可根据Scheme更改plist值 [英] iOS Pre-build action to change plist value based on Scheme

查看:137
本文介绍了iOS预构建操作可根据Scheme更改plist值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iOS应用程序,该应用程序正在使用Agentry框架来定义要连接的Agentry服务器URL.根据SAP规范,agentryServerURL参数包含在单独的branding.plist文件中.我想要做的是将针对不同环境的iOS方案与预构建操作联系在一起,以更改Agentry URL值.

I have an iOS application that is using the Agentry framework to define the Agentry server URL to connect. The agentryServerURL parameter is included in a separate branding.plist file as per the SAP specs. What I am trying to do is tie my iOS schemes for the different environments to a pre-build action in order to change the Agentry URL value.

这是我当前的脚本,但无法正常工作.

Here is my current script but it is not working.

#!/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

这是我第一次编写预构建脚本,因此可能与我的语法有关

This is the first time I have written a pre-build script so it is likely something with my syntax

推荐答案

尝试一下:

#!/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

这篇关于iOS预构建操作可根据Scheme更改plist值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆