Nag*_*jun 7 versioning scripting ios settings.bundle xcode11
我有一个应用,当我从
XCode>常规>版本。
但是最近我已将XCode更新为11.0,似乎脚本无法按预期工作:
version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $SRCROOT/MyApp/Info.plist`
version+=" ("
version+=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $SRCROOT/MyApp/Info.plist`
version+=")"
/usr/libexec/PlistBuddy "$SRCROOT/MyApp/Settings.bundle/Root.plist" -c "set PreferenceSpecifiers:1:DefaultValue $version"
Run Code Online (Sandbox Code Playgroud)
上面的脚本假设可以自动更新版本,并且可以在“设置”>“应用”中看到。
但是问题是,此脚本是否需要进行任何更改才能从XCode自动更新版本号?
当前,当版本从XCode> General> Version递增时,脚本将其替换为$(MARKETING_VERSION),这是不正确的。
版本字符串$MARKETING_VERSION和版本号$CURRENT_PROJECT_VERSION现在在构建过程中作为环境变量公开,因为它们现在保留在.pbxproj配置中。
你应该能够像这样实现你想要的:
version="$MARKETING_VERSION ($CURRENT_PROJECT_VERSION)"
/usr/libexec/PlistBuddy "$SRCROOT/MyApp/Settings.bundle/Root.plist" -c "set PreferenceSpecifiers:1:DefaultValue $version"
Run Code Online (Sandbox Code Playgroud)
它通过显示 MARKETING_VERSION 本身来工作:感谢 @dgimb 和 @Mojtaba Hosseini 的回答。
version="$MARKETING_VERSION"
version+=" ("
version+=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $SRCROOT/MyApp/Info.plist`
version+=")"
/usr/libexec/PlistBuddy "$SRCROOT/MyApp/Settings.bundle/Root.plist" -c "set PreferenceSpecifiers:1:DefaultValue $version"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
352 次 |
| 最近记录: |