ios - 使用 PlistBuddy 获取应用程序版本返回 "CFBundleShortVersionString does not exist"

标签 ios terminal plist

我知道这是一个简单而愚蠢的问题,但我找不到为什么会出错。我想在获取 xcarchive 文件后打印项目的应用程序版本。为此,我正在使用 PlistBuddy

/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" /build/My_Project.xcarchive/Info.plist 

这段代码返回

Print: Entry, "CFBundleShortVersionString", Does Not Exist

但是,我可以成功打印“ApplicationProperties”或整个 plist 文件。可能是什么问题?

最佳答案

CFBundleShortVersionString 属性存储在 ApplicationProperties 字典中,PlistBuddy 帮助说:

Entries consist of property key names delimited by colons.  Array items
are specified by a zero-based integer index.  Examples:
    :CFBundleShortVersionString
    :CFBundleDocumentTypes:2:CFBundleTypeExtensions

因此,为了获得此值,您需要运行以下命令:

/usr/libexec/PlistBuddy -c "Print ApplicationProperties:CFBundleShortVersionString" /build/My_Project.xcarchive/Info.plist 

关于ios - 使用 PlistBuddy 获取应用程序版本返回 "CFBundleShortVersionString does not exist",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54325422/

相关文章:

iphone - 如何将文件添加到 xcode iphone 项目中的 .plist?

objective-c - 对 RestKit iOS 应用程序的在线和离线支持

ios - macOS 和 iOS 目标是否应该共享相同的授权文件?

c - 如何为接受命令行参数的程序创建 Makefile

python - IPython 控制台找不到 "backports.shutil_get_terminal_size"并且不会加载

iphone - 在文档目录中找不到 plist 文件?如何以编程方式修改 plist?

ios - ios8 键盘高度有所不同

ios - 自动调整大小 CCLabelBMFont

c - 找不到图书馆?

ios - 我如何在 ios 的 Plist 文件中保存、检索、删除和更新我的数据?