我知道这是一个简单而愚蠢的问题,但我找不到为什么会出错。我想在获取 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/