We're trying out a new way of specifying version numbers for our app. I'd like to be able to check that the IPAs we're building have the version numbers we want. How do I get the version number out of the IPA?
Note - I'm not asking for a way of finding it from code inside the app; I've got a terminal open and the IPA file is built, and I want to know what to look for inside the IPA file.
Do the below from your terminal
//Unzip the file
unzip YourIPAFile.ipa
//Open payload folder
cd Payload
//Open your .app file
cd yourApp.app
//Open the plist file
open Info.plist
You can find the version under Bundle version key
There's a better way than PlistBuddy and grep:
unzip -d ipa YourIPA.ipa
defaults read `pwd`/ipa/Payload/YourAppName.app/Info CFBundleVersion
rm -rf ipa
It's worth noting that using defaults read
requires an absolute path to your app.
Unzip your ipa file
unzip YourIPAFile.ipa
Following plistBuddy command prints Bundle Version
/usr/libexec/PlistBuddy -c print Payload/NAME.app/Info.plist | grep CFBundleVersion
CFBundleVersion = 1.0
Following plistBuddy command prints BundleVersion String
/usr/libexec/PlistBuddy -c print Payload/NAME.app/Info.plist | grep CFBundleShortVersionString
CFBundleShortVersionString = 1.0
它在 IPA/payload/NAME.app/Info.plist 中
You can do it without writing and deleting a file by using tar's feature to extract a single file, then streaming the result to standard output and piping it into the plutil command (pl=>property lists). Extra bonus, pipe that to grep, looking for the string "Version" showing only one line past the found pattern.
In the command below, replace YourIPAFile.ipa with the name of the ipa file you want to inspect and YourAppName.app with the name of the bundle executable in the Plist.info file. For me, using flutter, these two values were the same "Runner", but it's essentially the directory in the tar file where the info.plist file is located.
tar -zxvOf YourIPAFile.ipa Payload/YourAppName.app/Info.plist | plutil -convert xml1 -r -o - -- - | grep -A 1 Version
The output is:
x Payload/YourAppName.app/Info.plist
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
--
<key>CFBundleShortVersionString</key>
<string>1.0.5</string>
--
<key>CFBundleVersion</key>
<string>1</string>
--
<key>DTPlatformVersion</key>
<string>14.0</string>
--
<key>MinimumOSVersion</key>
<string>9.0</string>
Or more to the point:
tar -zxvOf YourIPAFile.ipa Payload/YourAppName.app/Info.plist | plutil -convert xml1 -r -o - -- - | grep -A 1 CFBundleVersion
x Payload/YourAppName.app/Info.plist
<key>CFBundleVersion</key>
<string>1</string>
or
tar -zxvOf YourIPAFile.ipa Payload/YourAppName.app/Info.plist | plutil -convert xml1 -r -o - -- - | grep -A 1 CFBundleShortVersion
x Payload/YourAppName.app/Info.plist
<key>CFBundleShortVersionString</key>
<string>1.0.5</string>
I prefer to use ProvisionQL. https://github.com/ealeksandrov/ProvisionQL It provides a quick look of the IPA file (touching the IPA file with two fingers and clicking in Quick Look). It shows information like: Name, version, bundle id, device family, provisioning information, certificates, distribution profile, entitlements and more.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.