## Finding Out What Version Of Your iOS App Was Originally Installed : Part 2 – The Ugly Way

In part 1 I wrote up a method of finding out what version of your iOS app a user originally installed that works great, provided you can get a network connection and the App Store servers are up.

But if you can’t rely on that being the case, and you don’t want to wait for it to be true before you take whatever action you’re basing on the original version number, you can get the receipt data locally and process it.

## Finding Out What Version Of Your iOS App Was Originally Installed : Part 1 – The Easy Way

So, for whatever reason – lets say that you want to experiment with a free download and IAP monetization model in an existing paid app but you don’t want to double charge existing users, or maybe you need to do some clever user defaults or data model updates – you decide that you need to know what version of your app was originally purchased.

So far as I’ve been able to discover so far, there are basically two ways to go about this. Well, one way, but there are two ways of getting the data. Well, N ways actually, but let’s not get all forked up at this point. This is (one possible implementation of) the easy way.

Assuming you have a receipt (and you may well not, in your dev version at least, in which case you need a bit of SKReceiptRefresh magic) then you can find it in your app’s bundle, and (assuming you have some network connectivity, and can talk to it) you can fling it at the App Store servers and they’ll parse it for you and fling back some JSON.

It looks a little like this.

## The Problem

So you installed Jenkins on OS X using the .pkg installer (you’ll regret that, I promise), you’ve set up all your SSH keys correctly on the server and client – at least, you think you have, see later – but when you try and point a new job at your git repo, you get an error, like this one :
 

Permission denied (publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

 

Or this one :
 

Failed to connect to repository : Command "git ls-remote -h ssh://git@localhost/Users/git/Repos/HelloCI/ HEAD" returned status code 128:
stdout:
stderr: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

 

Built With Bootstrap