5

我在 settings.bundle 中添加“版本详细信息”。设置该标识符的更好方法是什么,我看到很少有人通过其他代码使用带有 Plistbuddy 的运行脚本来做到这一点。

如果你使用 plistbuddy 是不是这样,即使你不打开应用程序,它也会立即显示更新的版本详细信息。从应用程序更新版本后。店铺?

如果通过代码完成,则必须打开应用程序。在设置中查看更新。

4

1 回答 1

11

这是一个 PlistBuddy 示例:

#
buildPlist="Info.plist"
settingsPlist="Settings.bundle/Information.plist"

# Get the existing buildVersion and buildNumber values from the buildPlist
buildVersion=$(/usr/libexec/PlistBuddy -c "Print CFBuildVersion" $buildPlist)
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBuildNumber" $buildPlist)

# Increment the buildNumber
buildNumber=$(($buildNumber + 1))

# Set the version numbers in the buildPlist
/usr/libexec/PlistBuddy -c "Set :CFBuildNumber $buildNumber" $buildPlist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildVersion.$buildNumber" $buildPlist
# Set the version numbers in the settingsPlist
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:1:DefaultValue $buildVersion.$buildNumber" $settingsPlist

希望有帮助!

于 2014-10-30T19:15:20.527 回答