Tutorial: How To Implement In-App Update Functionality in Your iPhone/iPad App

Have you ever used an iPhone app where upon opening it, it tells you that there’s a new update? In some apps, it even stops you from using the app unless you update!

This is especially true in games where changes were made to the game server or engine that aren’t backwards-compatible with old versions.

Well if you need to implement in app update or force update functionality in your iOS app, then you’ve already done most of the work if you read my previous post on how to implement remote configuration into your iOS app.

So the basic idea is that upon app start-up, the app will fetch a remote file that indicates which versions of the app should update. The app will check to see if it’s own version exists in the remote file. If it does, then you can throw up a dialog and either force the user to update or allow the user to dismiss the dialog. If the current version doesn’t exist in the remote file, then we can treat that as “no updated needed”.

For example, you update file could look something like this:

This update file would indicate that all apps on version 1.1 should update. So your app will fetch this update file at app launch. We’ve learned how to parse this plist file into an NSDictionary in my last post, now all we need is to get the current version that the user is running and see if it exists in the NSDictionary.

There’s a more detailed walkthrough of this code snippet in this post, but the general idea is that you’ll create an NSURLRequest and NSURLConnection instance to fetch the remote XML file. Then parse the contents of the XML file into an NSDictionary and try to see if the current bundle version of the app exists in the parsed response.

The version we’re checking is specified in this build setting at the bottom of the screenshot:
build settings version number

I hope that helps you guys in implementing in app update checking. Put it to good use!