在Xcode中,如何检查环境变量以了解所选的构建配置或方案? [英] In Xcode, how can you check environment variables to know which build configuration or scheme you have selected?

查看:142
本文介绍了在Xcode中,如何检查环境变量以了解所选的构建配置或方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我的脚本中,在项目">目标">构建阶段"下的运行脚本"中,可以了解已运行的构建配置 我想复制一些专用捆绑包文件(如果它是Debug build config),但不复制它们(如果它是Release config).有没有办法在构建配置中设置Env变量,或者在运行时简单地获取构建配置的名称?

From my script in "Run Script" under the Project > Target > Build Phases is there a way to know which build configuration you have run I want to copy some private bundle files if it's the Debug build config, but not copy them if it's the Release config. Is there a way to either set an Env Variable in the Build Config, or simply get the name of the build config when running?

谢谢!

推荐答案

这对我有用:

if [[ "$CONFIGURATION" == "Debug" ]]
then
    echo "Copying ./BundlePrivate b/c BuildConfiguration=$CONFIGURATION"
    ditto ./BundlePrivate/ "$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
else
    echo "Not copying ./BundlePrivate b/c BuildConfiguration=$CONFIGURATION"
fi

这篇关于在Xcode中,如何检查环境变量以了解所选的构建配置或方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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