问题
在 App 上传到 App Store Content 审查过程中, 我们可能会遇到如下警告错误, 通常会发送邮件给我们。
Dear Developer,
We identified one or more issues with a recent delivery for your app, "Awesome App". Your delivery was successful, but you may wish to correct the following issues in your next delivery:
CFBundleVersion Mismatch - The CFBundleVersion value '8' of extension 'Awesome.app/PlugIns/Awesome.app-share.appex' does not match the CFBundleVersion value '10' of its containing iOS application 'Awesome.app'.
CFBundleVersion Mismatch - The CFBundleVersion value '8' of extension 'Awesome.app/PlugIns/Awesome.app.widget.appex' does not match the CFBundleVersion value '10' of its containing iOS application 'Awesome.app'.
After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to App Store Connect.
Best regards,
The App Store Team
正常情况下我们通过手动修改多个target版本或者build号保持一致, 重新上传即可解决问题。这里我尝试来实现了一种自动设置的方式, 能够避免每次都手动设置的烦恼。
实现方式
添加 Shell 脚本; 在Xcode Build Phases -> 添加 Run Script;
脚本实现
功能
- Release 环境下 App 主 target build 号自增;
- 其他 Extension Target 保持和主版本的版本号 build号一致; $ExtensionName为 Extension Target 的名字, 根据需求自己可以做出调整。
if [ $CONFIGURATION == Release ]; then
echo "Bumping build number..."
plist=${INFOPLIST_FILE}
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}")
if [[ "${buildnum}" == "" ]]; then
echo "No build number in $plist"
exit 2
fi
echo "Bumped build number to $buildnum"
buildnum=$(expr $buildnum + 1)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildnum" "${INFOPLIST_FILE}"
echo "Keep Extension Target build version and number as same as app"
buildver=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${plist}")
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $buildver" "$SRCROOT/$ExtensionName/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $buildver" "$SRCROOT/$ExtensionName/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildnum" "$SRCROOT/$ExtensionName/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildnum" "$SRCROOT/$ExtensionName/Info.plist"
else
echo $CONFIGURATION "build - Not bumping build number."
fi
网友评论