xcode PlistBuddy 或代码显示版本信息 iOS
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24226173/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PlistBuddy or code to display version information iOS
提问by NNikN
I am adding "Version Detail" in settings.bundle. What could be a better way to set that identifier, I have seen few do it through code other's use the run script with Plistbuddy.
我在 settings.bundle 中添加了“版本详细信息”。设置该标识符的更好方法是什么,我见过很少有人通过其他人使用带有 Plistbuddy 的运行脚本的代码来做到这一点。
Is it like that if you use plistbuddy, it show's the updated version details immediately even if you do not open the app. after version update from app. store?
是不是这样,如果你使用plistbuddy,即使你不打开应用程序,它也会立即显示更新的版本详细信息。从应用程序更新版本后。店铺?
If done through code, one has to open the app. to see the update in the settings.
如果通过代码完成,则必须打开该应用程序。在设置中查看更新。
回答by Jim
Here's a PlistBuddy example:
这是一个 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
Hope that helps!
希望有帮助!