Hi all,
I am using this code to get the "AppStore AppVersion" of my App,
On Feb 2nd I have released an App to AppStore as Version 2.4.3 (Available for users to download), but when I ran my code on Feb 3rd and tried to print console "Version Number @ iTunes ="; I was expecting to see it as 2.4.3 but I see it as 2.4.2 only,
Where could have I gone wrong? I am confused, (I am using this appStoreAppVersion to compare and send an alert to users if they are not on the latest version). (If I am not clear Please ping me in person)
Code Snippet:
{
var dictionary = NSBundle.MainBundle.InfoDictionary;
string applicationID = "org.XYZ";
NSUrl url = new NSUrl($"http://itunes.apple.com/lookup?bundleId={applicationID}");
NSData data = NSData.FromUrl(url);
NSError error = new NSError();
NSDictionary lookup = NSJsonSerialization.Deserialize(data, 0, out error) as NSDictionary;
if (error == null
&& lookup != null
&& lookup.Keys.Length >= 1
&& lookup["resultCount"] != null
&& Convert.ToInt32(lookup["resultCount"].ToString()) > 0)
{
var results = lookup[@"results"] as NSArray;
if (results != null && results.Count > 0)
{
appStoreAppVersion = results.GetItem<NSDictionary>(0)["version"].ToString();
Console.WriteLine("Version Number @ iTunes = " + appStoreAppVersion);
}
}
}