通过Xcode的pre|post-action功能,在Build或打包时通过脚本的方式检查提示环境配置.
注意 Provide build seetings from 选项选择自己的scheme
快捷键[shift] + [cmd] + [,]
通知
弹窗
方式一
#!/bin/sh
#输出内容到prebuild.log
# exec > "${PROJECT_DIR}/prebuild.log" 2>&1
#applescript引用环境变量
osascript -e 'tell app "Xcode" to display dialog "'${CONFIGURATION}'"'
xcschemeDir=${PROJECT_DIR}/Cicero_iOS.xcodeproj/xcshareddata/xcschemes/Cicero_iOS.xcscheme
config=$(xmllint --xpath "string(//Scheme/ArchiveAction/@buildConfiguration)" $xcschemeDir)
if [ $config != "Release" ]; then
osascript -e 'tell app "Xcode" to display dialog "正在非Release打包!"'
fi
方式二
#输出内容到prebuild.log
# exec > "${PROJECT_DIR}/prebuild.log" 2>&1
#applescript引用环境变量
osascript -e 'tell app "Xcode" to display dialog "'${CONFIGURATION}'"'
if [ $CONFIGURATION != "Release" ]; then
osascript -e 'tell app "Xcode" to display dialog "正在非Release打包!"'
fi