How to get the correct version number on iOS?

I used this method to get version number of my XNA game:

    public static string GetVersionNumber()
    {
        var asm = Assembly.GetExecutingAssembly();
        var parts = asm.FullName.Split(',');
        return parts[1].Split('=')[1];
    }

But on iOS, it always returns “1.0.0.0”, which is different from the verion number set in the Info.plist file.

I googled a bit and found that NSBundle.MainBundle.InfoDictionary[“CFBundleVersion”] should return the version number, but I can’t access NSBundle in the solution. It seems to be Xcode and obj-c related… =(

You can access it, you just need a using for it :slight_smile:

using MonoTouch.Foundation;

NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleVersion")

Oh I see! Thanks Nezz! :slight_smile: