问题
Xcode打包, bulidversion自增报错的处理(error token is "$(CURRENT_PROJECT_VERSION) + 1")
with a nonzero exit code
原因
在xcode 11中,在项目的构建设置中有一个新的部分叫做版本控制
并且CFBundleShortVersionString
自动更改为$(MARKETING_VERSION),
CFBundleVersion会改为$(CURRENT_PROJECT_VERSION)(测试发现只要手动修改这个再打包就会变化)。
修改脚本
升级之前的自增脚本:
echo $CONFIGURATION
if [ "Release" == "${CONFIGURATION}" ]
then
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
echo "build number increase"
fi
升级后的脚本:
echo $CONFIGURATION
if [ "Release" == "${CONFIGURATION}" ]
then
///主要是 替换了这一句
buildNumber=$CURRENT_PROJECT_VERSION
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
echo "build number increase"
fi
转载原文:https://www.cnblogs.com/programmer-blog/p/12361947.html
网友评论