Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the simplest way to check the current version of your app against the latest version in the app store?

Tags:

ios

iphone

ipad

If the iOS SDK doesn't have functionality for this, then what if I have a basic (static) website, and somewhere on that website I manually set a piece of data that specifies the latest version of my app in the app store every time I release an update? How can I make my app query the website for that version data and check it against the version running on the iOS device?

like image 959
BeachRunnerFred Avatar asked Jan 12 '11 22:01

BeachRunnerFred


People also ask

How do I check what version of an app I have?

Open the Settings app on your Android device. Open the "Applications" and/or "Application Manager" section. Tap on your app to select it. The App Settings Panel has multiple options including App Version, Notifications, and Location.

How do I check app version in Apple Store?

Android shows the version number for every app in the "Apps" settings menu; All you need to do is open the list, tap the app you want, and scroll to the very bottom. On iOS and iPadOS, the equivalent of that would be going to the app's preferences via Settings –> [App Name], as seen in Option 1 below.

How do you know if you have the latest version of an app on iPhone?

Open the App Store. Tap your profile icon at the top of the screen. Scroll to see pending updates and release notes. Tap Update next to an app to update only that app, or tap Update All.


2 Answers

You are on the right track. You need to make an HTTP request to your static version web page. To do this you can use an NSURLConnection object. So something like:

NSURL * url = [NSURL URLWithString:@"http://yourweb.com/version.txt"];
NSURLRequest * request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:60];
 _connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];  

Then in your delegate implementation:

(void)connection:(NSURLConnection*)connection didReceiveResponse:(NSHTTPURLResponse*)response
{
    if(response.statusCode != 200)
        // you got an error
}

- (void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error
{
     // again with the errors ...
}

// you got some data ... append it to your chunk
// in your case all the data should come back in one callback
- (void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)data
{
    [mData appendData:data];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
   // your request finished ... check the version here
}

So in your connectionDidFinishLoading you have a look at mData that you have collected. Parse out the version number and compare it to your bundle version number:

[self infoValueForKey:@"CFBundleVersion"];
like image 146
RedBlueThing Avatar answered Oct 15 '22 03:10

RedBlueThing


You can make a query like http://itunes.apple.com/en/lookup?bundleId=com.easi6.doorsndots to AppStore.

Returning JSON has an version information (currently on AppStore) which can be compared the other in bundle.

like image 33
Jaehwa Han Avatar answered Oct 15 '22 03:10

Jaehwa Han