加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PlistBuddy或用于显示iOS版本信息的代码

发布时间:2020-12-14 18:04:03 所属栏目:百科 来源:网络整理
导读:我在settings.bundle中添加“Version Detail”.什么是设置该标识符的更好方法,我看到很少通过代码使用Plistbuddy的运行脚本来完成. 是这样的,如果你使用plistbuddy,它会立即显示更新版本的详细信息,即使你没有打开应用程序.从应用程序版本更新后.商店? 如果
我在settings.bundle中添加“Version Detail”.什么是设置该标识符的更好方法,我看到很少通过代码使用Plistbuddy的运行脚本来完成.

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

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

解决方法

这是一个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

希望有所帮助!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读