How to parse Info.plist file from ipa
I want to write a program to get application details like. application name, version, package ID, from ipa. However, this file is not a simple text file, it is encoded in some way and my program cannot parse it.
Is there a way to decode this file?
UPDATE
To clarify the matter, I am writing a python program to get application information from the ipa files that I exported from Xcode.
For those who don't have Apple developer logins, here are two answers from the accepted answer link (you need to log in to see it):
- use
PlistBuddy
-
/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" yourBinaryOrXmlPlist.plist
-
- There are many other ways to parse plist binaries as well. For example, I am using Python, and there is a library called biplist that is exactly used to read and write binary plist files and supports both Python 2 and 3. Also, "plistlib" in Python 3.4 supports binary manipulation with new APIs. interfaces.
My Python version: https://gist.github.com/noamtm/a8ddb994df41583b64f8
In my research, the tricky bit was parsing a binary plist as python PlistLib can't read it:
from Foundation import NSData, NSPropertyListSerialization
# Use PyObjC, pre-installed in Apple Python dist.
def parse_plist(info_plist_string):
data = NSData.dataWithBytes_length_(info_plist_string, len(info_plist_string))
return NSPropertyListSerialization.propertyListWithData_options_format_error_(data, 0, None, None)
It's easy if you have a MacBook.
Then follow this recommendation: http://osxdaily.com/2011/04/07/extract-and-explore-an-ios-app-in-mac-os-x/
- Rename from file.ipa -> file.zip
- Unpack the .zip file
- Go to the "Payload" folder
- Right Click Application File -> Show Package Contents
- .See Info.plist
Got a response from the Apple Developer Forum:
PlistBuddy is what you are looking for:
/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" yourBinaryOrXmlPlist.plist
Double clicking on the list will open from Xcode.