0

Updated Question

I have managed to read the info.plist file and I got the below response. I don't know how to decrypt into XML.

screenshot

I am not sure, how can I read this?


Actual Question

I want to create an application like, Diawi.

For that, I have completed the Android application upload part and now I want to read the IPA information like application name, application version, package name etc in C#.

I have searched a lot but could not found any documentation for that.

Can anyone please guide me the right way to do it?

Chandresh Khambhayata
  • 1,748
  • 2
  • 31
  • 60

1 Answers1

0

An IPA file is a ZIP file, so the first thing you need to do is extract this file.

After unzip IPA file, we will get a folder named Payload, and a file with extension app will be stored in folder Payload, maybe this app named is xxxx.app, and info.plist we can located in this app xxxx.app, the path related to folder Payload should be Payload/xxxx.app/info.plist.

    // parse info.plist
    File plistFile = new File(plistFilePath);
    NSDictionary rootDict = null;
    try {
        rootDict = (NSDictionary) PropertyListParser.parse(plistFile);

        // get bundle id
        NSString parameter = (NSString) rootDict.objectForKey("CFBundleIdentifier");
        ipaInfo.put("CFBundleIdentifier", parameter.toString());

        // get application name
        parameter = (NSString) rootDict.objectForKey("CFBundleName");
        ipaInfo.put("CFBundleName", parameter.toString());

        // get version
        parameter = (NSString) rootDict.objectForKey("CFBundleVersion");
        ipaInfo.put("CFBundleVersion", parameter.toString());

        // get bundle display name
        parameter = (NSString) rootDict.objectForKey("CFBundleDisplayName");
        ipaInfo.put("CFBundleDisplayName", parameter.toString());

        // get ios mini. version
        parameter = (NSString) rootDict.objectForKey("MinimumOSVersion");
        ipaInfo.put("MinimumOSVersion", parameter.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
Vinay Rathod
  • 1,262
  • 1
  • 10
  • 19
  • NSDirectory is the class of Xcode and not of C#, may I know is there any library for the same in c#? – Chandresh Khambhayata Aug 30 '17 at 06:00
  • 1
    var data = new Dictionary(); foreach (var row in File.ReadAllLines(PATH_TO_FILE)) data.Add(row.Split('=')[0], string.Join("=",row.Split('=').Skip(1).ToArray())); Console.WriteLine(data["ServerName"]); – Vinay Rathod Aug 30 '17 at 06:10
  • I have updated the question. Actually, I can read the info.plist file but it is encrypted and the code you have shared is only able to read the XML file. – Chandresh Khambhayata Aug 30 '17 at 09:19