我知道这是一个简单而愚蠢的问题,但我找不到为什么我会收到错误。我想在获取xcarchive
文件后打印项目的应用版本。我正在使用PlistBuddy
。
/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" /build/My_Project.xcarchive/Info.plist
此代码返回
打印:条目,“CFBundleShortVersionString”,不存在
但是,我可以成功打印“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