4

I'm currently building a Swift based iOS application.

In my application, I'd like to validate specific security features of the device.

One of these is to ensure that the device has the latest iOS version installed.

Of course, getting the currently installed version of iOS on the device is quite simple. But I can't seem to find any API to programmatically determine what the latest available iOS version is.

Is there some API to do this? Or perhaps some REST API I can call on an Apple site to glean this information?

Ryan0751
  • 43
  • 3
  • 2
    Maybe you could configure an API at _your_ site that the app could check. Rather like how Sparkle works. – matt Jun 18 '18 at 13:49
  • Creating a hosted API is a possibility. I presume it would require manually updating the iOS version within that server though, which is better than requiring a new App version, but is still just moving the problem around. – Ryan0751 Jun 18 '18 at 14:02
  • Maybe you could set something up to parse Apple's website to look for the latest version… or alternatively [Wikipedia](https://en.wikipedia.org/wiki/IOS_version_history), which might be a bit easier to manage with an API? Or you could just hardcode the latest iOS version in your app and then just update your app whenever Apple releases an update, and then it's pretty easy to check if a user doesn't have the latest version of your app. – shim Jun 18 '18 at 14:05
  • @shim “and then it's pretty easy to check if a user doesn't have the latest version of your app” How? – matt Jun 18 '18 at 14:18
  • For example: https://github.com/ArtSabintsev/Siren – shim Jun 18 '18 at 14:20

1 Answers1

6

Apple provides an API at curl http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/com.apple.jingle.appserver.client.MZITunesClientCheck/version. Test it on the command line using:

curl http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/com.apple.jingle.appserver.client.MZITunesClientCheck/version

The response is XML, and the information you need is keyed by device version (eg iPhone8,1).

You can access your device's version by using sysctlbyname() from Swift.

Update Looks like the old URL (http://phobos.apple.com./version) died a while back (thanks Troy) so have updated my answer with another version. I have no idea if the content is the same.

jjrscott
  • 1,386
  • 12
  • 16